Skip to content

Commit c7a4437

Browse files
committed
mco: Use NVM instead of Node
1 parent 8f68b2c commit c7a4437

File tree

5 files changed

+128
-22
lines changed

5 files changed

+128
-22
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @PsycleResearch/devs-back

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: 2
2+
3+
updates:
4+
# Maintain dependencies for GitHub Actions
5+
- package-ecosystem: "github-actions"
6+
directory: /
7+
schedule:
8+
interval: weekly
9+
day: "friday"
10+
time: "08:00"
11+
timezone: "Europe/Paris"
12+
target-branch: master
13+
assignees:
14+
- mbaumanndev
15+
- Mindstan
16+
labels:
17+
- dependencies
18+
rebase-strategy: disabled
19+
20+
# Maintain dependencies for the Dockerfile
21+
- package-ecosystem: docker
22+
directory: /
23+
schedule:
24+
interval: weekly
25+
day: "friday"
26+
time: "08:00"
27+
timezone: "Europe/Paris"
28+
target-branch: master
29+
assignees:
30+
- mbaumanndev
31+
- Mindstan
32+
labels:
33+
- dependencies
34+
rebase-strategy: disabled

.github/workflows/pr-checks.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: PR checks
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
types: [opened, ready_for_review, synchronize, reopened]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
12+
13+
jobs:
14+
queue:
15+
runs-on: ubuntu-latest
16+
if: github.event.pull_request.draft == false || github.ref == 'refs/heads/master'
17+
timeout-minutes: 1
18+
19+
outputs:
20+
should_skip: ${{ steps.skip.outputs.should_skip }}
21+
paths_result: ${{ steps.skip.outputs.paths_result }}
22+
23+
steps:
24+
- id: skip
25+
uses: fkirc/skip-duplicate-actions@v5
26+
with:
27+
concurrent_skipping: "same_content_newer"
28+
cancel_others: true
29+
skip_after_successful_duplicate: true
30+
do_not_skip: '["workflow_dispatch", "schedule"]'
31+
paths: '["Dockerfile", ".dockerignore", "Makefile", ".github/workflows/pr-checks.yml"]'
32+
paths_filter: |
33+
image:
34+
paths:
35+
- "Dockerfile"
36+
- ".dockerignore"
37+
- "Makefile"
38+
ci:
39+
paths:
40+
- ".github/workflows/pr-checks.yml"
41+
42+
build-image:
43+
runs-on: ubuntu-latest
44+
needs: queue
45+
if: github.ref == 'refs/heads/master' || ( needs.queue.outputs.should_skip != 'true' && ( !fromJSON(needs.queue.outputs.paths_result).image.should_skip || !fromJSON(needs.queue.outputs.paths_result).ci.should_skip ) )
46+
timeout-minutes: 10
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
fetch-depth: 0
52+
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
56+
- name: Build image
57+
run: make image
58+
59+
status:
60+
runs-on: ubuntu-latest
61+
needs: [queue, build-image]
62+
if: ${{ always() && !cancelled() }}
63+
timeout-minutes: 1
64+
65+
steps:
66+
- name: Check status
67+
env:
68+
QUEUE_OK: ${{ needs.queue.result == 'success' }}
69+
IMAGE_OK: ${{ needs.build-image.result == 'success' || needs.build-image.result == 'skipped' }}
70+
run: |
71+
echo "Queue: $QUEUE_OK"
72+
echo "Frontend: $IMAGE_OK"
73+
if [[ $QUEUE_OK == "true" && $IMAGE_OK == "true" ]]; then
74+
echo "All good"
75+
exit 0
76+
else
77+
echo "Something went wrong"
78+
exit 1
79+
fi

Dockerfile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,6 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2
2828
./aws/install && \
2929
rm -rf aws awscliv2.zip
3030

31-
# Install NodeJS
32-
ARG NODE_MAJOR=24
33-
34-
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
35-
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
36-
apt-get update && apt-get install nodejs -y && \
37-
rm -rf /var/lib/apt/lists/* && \
38-
apt-get clean &&\
39-
npm install --global corepack &&\
40-
corepack enable
41-
4231
# Install Golang
4332
ARG GOLANG_VER=1.23.2
4433
RUN curl -fsSL https://go.dev/dl/go${GOLANG_VER}.linux-amd64.tar.gz | tar -C /usr/local -xz
@@ -52,9 +41,19 @@ WORKDIR ${HOME}
5241
RUN mkdir -p ${HOME}/go
5342
ENV PATH=${HOME}/go/bin:${PATH}
5443

55-
ENV PYENV_ROOT=${HOME}/.pyenv
44+
# Install NVM & Node
45+
ARG NODE_MAJOR=24
46+
ENV NVM_VERSION=v0.40.3
47+
ENV NVM_DIR="${HOME}/.nvm"
48+
ENV BASH_ENV="${HOME}/.bash_env"
49+
RUN touch "${BASH_ENV}" && \
50+
echo '. "${BASH_ENV}"' >> ~/.bashrc && \
51+
mkdir -p ${NVM_DIR} && \
52+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh | PROFILE="${BASH_ENV}" bash && \
53+
/bin/bash -c "source ${NVM_DIR}/nvm.sh && nvm install ${NODE_MAJOR}"
5654

5755
# Install Pyenv
56+
ENV PYENV_ROOT=${HOME}/.pyenv
5857
RUN git clone https://github.com/pyenv/pyenv.git ${PYENV_ROOT} && \
5958
cd ${PYENV_ROOT} && src/configure && make -C src
6059

@@ -79,4 +78,7 @@ RUN PYTHON_CONFIGURE_OPTS=--enable-shared pyenv install 3.9 && \
7978
ARG POETRY_VERSION=2.1.3
8079
RUN curl -sSL https://install.python-poetry.org | python3 - --version ${POETRY_VERSION}
8180

81+
# set ENTRYPOINT for reloading nvm-environment
82+
ENTRYPOINT ["bash", "-c", "source $NVM_DIR/nvm.sh && exec \"$@\"", "--"]
83+
8284
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)