From c5dac6dd450750bd902637ad8f272d735ce78716 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 15 Jan 2024 14:35:07 +0100 Subject: [PATCH] Upgrade NodeJS version to 20 --- docs/development.md | 2 +- docs/installation.md | 7 +++++-- frontend/.nvmrc | 2 +- frontend/Dockerfile | 8 ++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/development.md b/docs/development.md index 7e94e256b..d86437515 100644 --- a/docs/development.md +++ b/docs/development.md @@ -4,7 +4,7 @@ Installation in development: ## Prerequisite -- You need to use a node version equal or above 18 +- You need to use a node version equal or above 20 - Use nvm and then: ```bash diff --git a/docs/installation.md b/docs/installation.md index 4cfd4193e..d50293fce 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -11,13 +11,14 @@ If you follow the [Install without Docker (not recommended)](#install-without-do ### Sentry To report application crashes and any errors encountered by users, you can use [Sentry](https://sentry.io/). -In the Sentry backoffice, create your project and copy the DSN key which you can paste into the `SENTRY_DSN` environment variable. +In the Sentry backoffice, create your project and copy the DSN key which you can paste into the `SENTRY_DSN` environment variable. # Install with Docker (recommended) ## Global process Before starting the technical installation, here is an overview of the global process: + - Developers are working on code source of this repository where you will also find the documentation, issues and releases - Once they have a new version of the application ready, they will release it, build a Docker image of this new version and push it in the [packages repository](https://github.com/orgs/GeotrekCE/packages/container/package/geotrek-rando-v3%2Fgeotrek-rando) - If required, they will also make changes to the docker-compose file and customization template in the [installer dedicated repository](https://github.com/GeotrekCE/Geotrek-rando-v3-installer) and release a new version of it @@ -103,6 +104,7 @@ sudo certbot --nginx ## Upgrade Geotrek-rando version To find out the current Geotrek-rando version of your running container, you can execute (by renaming `rando-nodeserver-1` with the name of your container): + ``` docker exec -t -i rando-nodeserver-1 node -p "require('./package.json').version" ``` @@ -147,7 +149,7 @@ Install nodejs: sudo apt update sudo apt -y upgrade sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates -curl -sL https://deb.nodesource.com/setup_17.x | sudo -E bash - +curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt -y install nodejs ``` @@ -164,6 +166,7 @@ cd Geotrek-rando-v3/frontend/ ``` Install dependencies + ```sh yarn ``` diff --git a/frontend/.nvmrc b/frontend/.nvmrc index 9dfef4721..016e34baf 100644 --- a/frontend/.nvmrc +++ b/frontend/.nvmrc @@ -1 +1 @@ -v18.12.0 +v20.17.0 diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 4c504edfe..83ae8a859 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,5 +1,5 @@ # Install dependencies only when needed -FROM node:18-alpine AS deps +FROM node:20-alpine AS deps # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. RUN apk add --no-cache libc6-compat g++ gcc libgcc libstdc++ linux-headers make python3 WORKDIR /app @@ -7,13 +7,13 @@ COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile # Rebuild the source code only when needed -FROM node:18-alpine AS builder +FROM node:20-alpine AS builder WORKDIR /app COPY . . COPY --from=deps /app/node_modules ./node_modules RUN yarn build -FROM node:18-alpine AS builder_optim +FROM node:20-alpine AS builder_optim WORKDIR /app COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/package.json ./package.json @@ -21,7 +21,7 @@ COPY --from=builder /app/yarn.lock ./yarn.lock RUN yarn install --production --ignore-scripts --prefer-offline # Production image, copy all the files and run next -FROM node:18-alpine AS runner +FROM node:20-alpine AS runner WORKDIR /app ENV NODE_ENV production