From 4327af935d7a5844f085d0af24145c6e1f99abfd Mon Sep 17 00:00:00 2001 From: Pavel Sorokin <60606414+pavel-snyk@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:42:02 +0100 Subject: [PATCH 1/3] feat: upgrade base image to ubuntu:24.04 Node.js is updated to 23, because it is the latest now --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9b2109493..47aaf433d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1024,8 +1024,9 @@ workflows: - team-broker-snyk requires: - Scan repository for secrets + additional_arguments: "--build-arg BASE_IMAGE=ubuntu:24.04" dockerfile: dockerfiles/base/Dockerfile - nodejs_cycle: "21" + nodejs_cycle: "23" project_name: broker-nlatest post-steps: - notify-slack-on-failure From 850fc7ed9e1b4101f0c28f180aa49c1e76c73aa7 Mon Sep 17 00:00:00 2001 From: Pavel Sorokin <60606414+pavel-snyk@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:52:22 +0100 Subject: [PATCH 2/3] fix(docker): fix FromAsCasing warning from docker build checks https://docs.docker.com/reference/build-checks/from-as-casing --- dockerfiles/base/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockerfiles/base/Dockerfile b/dockerfiles/base/Dockerfile index 9f2d9a6ea..7eaedfc4f 100644 --- a/dockerfiles/base/Dockerfile +++ b/dockerfiles/base/Dockerfile @@ -2,7 +2,7 @@ ARG BASE_IMAGE=ubuntu:20.04 ARG NODE_VERSION=20.11.0 -FROM ${BASE_IMAGE} as node-base +FROM ${BASE_IMAGE} AS node-base ARG NODE_VERSION ENV DEBIAN_FRONTEND=noninteractive @@ -76,7 +76,7 @@ EOF -FROM node-base as broker-builder +FROM node-base AS broker-builder ARG NODE_VERSION ENV NPM_CONFIG_PREFIX=/home/node/.npm-global From 0c438db7dd6a6246b95ed06960ee683900e67463 Mon Sep 17 00:00:00 2001 From: Pavel Sorokin <60606414+pavel-snyk@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:06:13 +0100 Subject: [PATCH 3/3] fix(docker): allow to customize user uid and gid via build args since ubuntu 24.04 the dedicated 'ubuntu' user with id 1000 is added, with build arg and default value 1000 we keep backward compatibility with ubuntu:20.04 images, but can override the value for ubuntu:24.04 images --- .circleci/config.yml | 2 +- dockerfiles/base/Dockerfile | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 47aaf433d..44f96784d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1024,7 +1024,7 @@ workflows: - team-broker-snyk requires: - Scan repository for secrets - additional_arguments: "--build-arg BASE_IMAGE=ubuntu:24.04" + additional_arguments: "--build-arg BASE_IMAGE=ubuntu:24.04 --build-arg USER_UID=2000" dockerfile: dockerfiles/base/Dockerfile nodejs_cycle: "23" project_name: broker-nlatest diff --git a/dockerfiles/base/Dockerfile b/dockerfiles/base/Dockerfile index 7eaedfc4f..f4d8116eb 100644 --- a/dockerfiles/base/Dockerfile +++ b/dockerfiles/base/Dockerfile @@ -8,11 +8,13 @@ ARG NODE_VERSION ENV DEBIAN_FRONTEND=noninteractive ENV NODE_VERSION=${NODE_VERSION} ENV PATH=$PATH:/home/node/.npm-global/bin +ARG USER_UID=1000 +ARG USER_GID=${USER_UID} RUN <