From 3a9d66c648d48790d66401cc09d458801a6bb439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= <91831478+lemeurherve@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:08:20 +0100 Subject: [PATCH] fix: replace `npm install` by `npm ci` to get deterministic builds (#54) * fix: replace `npm install` by `npm ci` to get deterministic builds * no need to upgrade npm in the Makefile, npm ci already existing in node 10 image * use postgresql version 10 in docker-compose for tests like the 'produplink' database currently used in production --- Dockerfile | 5 ++++- Makefile | 2 +- docker-compose.yml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2105143..4a4e744 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,14 @@ FROM node:9 as builder +RUN npm install --global npm@5.7.0 && \ + npm version + ARG APP_DIR=/srv/uplink WORKDIR ${APP_DIR} COPY package*json ${APP_DIR}/ -RUN npm install +RUN npm ci # Doing a multi-stage build to reset some stuff for a smaller image FROM node:9-alpine diff --git a/Makefile b/Makefile index b23fa50..da9b4e6 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ version: npm version depends: version package.json package-lock.json ## Install node dependencies - if [ ! -d node_modules ]; then npm install; fi; + if [ ! -d node_modules ]; then npm ci; fi; build: depends ## Compile TypeScript $(TSC) diff --git a/docker-compose.yml b/docker-compose.yml index 6dc6d1f..3ede822 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: db: - image: postgres:alpine + image: postgres:10-alpine environment: - 'POSTGRES_PASSWORD=jenkinsuplink' # Used for psql non-interactive scripting