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] 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 <