From c7a4437a47f004b168f55b6e4ded44dd6f811526 Mon Sep 17 00:00:00 2001 From: Maxime Baumann Date: Wed, 14 Jan 2026 16:37:21 +0100 Subject: [PATCH] mco: Use NVM instead of Node --- .github/CODEOWNERS | 1 + .github/PULL_REQUEST_TEMPLATE.md | 10 ---- .github/dependabot.yml | 34 ++++++++++++++ .github/workflows/pr-checks.yml | 79 ++++++++++++++++++++++++++++++++ Dockerfile | 26 ++++++----- 5 files changed, 128 insertions(+), 22 deletions(-) create mode 100644 .github/CODEOWNERS delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/pr-checks.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..3cc3e31 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @PsycleResearch/devs-back diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 68d2d27..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,10 +0,0 @@ -### Before creating my PR, I made sure to: - -- [ ] execute unit tests : `make test` -- [ ] execute e2e tests : `make run-e2e` -- [ ] write new tests (unit, e2e) -- [ ] [infra](https://github.com/PsycleTeam/infra) has been modified accordingly (env vars, installation) - -### To review the PR: - -- List the tasks needed to review your PR diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3d5f640 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,34 @@ +version: 2 + +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: / + schedule: + interval: weekly + day: "friday" + time: "08:00" + timezone: "Europe/Paris" + target-branch: master + assignees: + - mbaumanndev + - Mindstan + labels: + - dependencies + rebase-strategy: disabled + + # Maintain dependencies for the Dockerfile + - package-ecosystem: docker + directory: / + schedule: + interval: weekly + day: "friday" + time: "08:00" + timezone: "Europe/Paris" + target-branch: master + assignees: + - mbaumanndev + - Mindstan + labels: + - dependencies + rebase-strategy: disabled \ No newline at end of file diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..bdc3e92 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,79 @@ +name: PR checks + +on: + push: + branches: [master] + pull_request: + types: [opened, ready_for_review, synchronize, reopened] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + +jobs: + queue: + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false || github.ref == 'refs/heads/master' + timeout-minutes: 1 + + outputs: + should_skip: ${{ steps.skip.outputs.should_skip }} + paths_result: ${{ steps.skip.outputs.paths_result }} + + steps: + - id: skip + uses: fkirc/skip-duplicate-actions@v5 + with: + concurrent_skipping: "same_content_newer" + cancel_others: true + skip_after_successful_duplicate: true + do_not_skip: '["workflow_dispatch", "schedule"]' + paths: '["Dockerfile", ".dockerignore", "Makefile", ".github/workflows/pr-checks.yml"]' + paths_filter: | + image: + paths: + - "Dockerfile" + - ".dockerignore" + - "Makefile" + ci: + paths: + - ".github/workflows/pr-checks.yml" + + build-image: + runs-on: ubuntu-latest + needs: queue + 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 ) ) + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build image + run: make image + + status: + runs-on: ubuntu-latest + needs: [queue, build-image] + if: ${{ always() && !cancelled() }} + timeout-minutes: 1 + + steps: + - name: Check status + env: + QUEUE_OK: ${{ needs.queue.result == 'success' }} + IMAGE_OK: ${{ needs.build-image.result == 'success' || needs.build-image.result == 'skipped' }} + run: | + echo "Queue: $QUEUE_OK" + echo "Frontend: $IMAGE_OK" + if [[ $QUEUE_OK == "true" && $IMAGE_OK == "true" ]]; then + echo "All good" + exit 0 + else + echo "Something went wrong" + exit 1 + fi diff --git a/Dockerfile b/Dockerfile index 06e4c7a..21c666b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,17 +28,6 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2 ./aws/install && \ rm -rf aws awscliv2.zip -# Install NodeJS -ARG NODE_MAJOR=24 - -RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ - 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 && \ - apt-get update && apt-get install nodejs -y && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get clean &&\ - npm install --global corepack &&\ - corepack enable - # Install Golang ARG GOLANG_VER=1.23.2 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} RUN mkdir -p ${HOME}/go ENV PATH=${HOME}/go/bin:${PATH} -ENV PYENV_ROOT=${HOME}/.pyenv +# Install NVM & Node +ARG NODE_MAJOR=24 +ENV NVM_VERSION=v0.40.3 +ENV NVM_DIR="${HOME}/.nvm" +ENV BASH_ENV="${HOME}/.bash_env" +RUN touch "${BASH_ENV}" && \ + echo '. "${BASH_ENV}"' >> ~/.bashrc && \ + mkdir -p ${NVM_DIR} && \ + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh | PROFILE="${BASH_ENV}" bash && \ + /bin/bash -c "source ${NVM_DIR}/nvm.sh && nvm install ${NODE_MAJOR}" # Install Pyenv +ENV PYENV_ROOT=${HOME}/.pyenv RUN git clone https://github.com/pyenv/pyenv.git ${PYENV_ROOT} && \ cd ${PYENV_ROOT} && src/configure && make -C src @@ -79,4 +78,7 @@ RUN PYTHON_CONFIGURE_OPTS=--enable-shared pyenv install 3.9 && \ ARG POETRY_VERSION=2.1.3 RUN curl -sSL https://install.python-poetry.org | python3 - --version ${POETRY_VERSION} +# set ENTRYPOINT for reloading nvm-environment +ENTRYPOINT ["bash", "-c", "source $NVM_DIR/nvm.sh && exec \"$@\"", "--"] + CMD ["/bin/bash"]