From 7e19d34f519e4a75fb92ada659922714dd511afc Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Thu, 9 Nov 2023 17:16:39 +0100 Subject: [PATCH] Use Node 20 --- Dockerfile | 5 ++--- docker-compose.development.yml | 7 +++++-- install_node.sh | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100755 install_node.sh diff --git a/Dockerfile b/Dockerfile index 83e07fdd..cf325d6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,11 @@ # builder image FROM python:3.11 AS builder -RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - -RUN apt-get update && apt-get install -y nodejs npm - ADD . /build/ WORKDIR /build +RUN ./install_node.sh + RUN HUSKY_SKIP_INSTALL=1 make RUN make build diff --git a/docker-compose.development.yml b/docker-compose.development.yml index 8f993ca6..607c6477 100644 --- a/docker-compose.development.yml +++ b/docker-compose.development.yml @@ -45,6 +45,10 @@ services: source: .prettierrc.yaml target: /newdle/client/.prettierrc.yaml read_only: true + - type: bind + source: install_node.sh + target: /newdle/client/install_node.sh + read_only: true ports: - 3000:3000 depends_on: @@ -59,8 +63,7 @@ services: - bash - -c - | - curl -sL https://deb.nodesource.com/setup_16.x | bash - - apt-get install -y nodejs npm + ./install_node.sh npm install npm run extract npm run compile diff --git a/install_node.sh b/install_node.sh new file mode 100755 index 00000000..10f8fb0a --- /dev/null +++ b/install_node.sh @@ -0,0 +1,16 @@ +# https://github.com/nodesource/distributions#installation-instructions +NODE_MAJOR=20 + +apt-get update +apt-get install -y ca-certificates curl gnupg +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | + gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg + +# Create node deb repository +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" \ + > /etc/apt/sources.list.d/nodesource.list + +# Install node and npm +apt-get update +apt-get install nodejs -y