diff --git a/api/builder/Dockerfile b/api/builder/Dockerfile index 266cfa6d1..612f8df3c 100644 --- a/api/builder/Dockerfile +++ b/api/builder/Dockerfile @@ -3,12 +3,15 @@ FROM golang:1.21.12-bookworm # The URL where the protoc binary can be downloaded. Is different depending on architecture. ARG PROTOC_URL +# The UID of the user to create +ARG UID + # Install core dependencies RUN apt update RUN apt install -y wget unzip bash # Set up user -RUN useradd -m -s /bin/bash user +RUN useradd -u $UID -m -s /bin/bash user USER user WORKDIR /home/user # Remove default crud diff --git a/api/builder/build-docker.sh b/api/builder/build-docker.sh index 252b10151..eb826b43a 100755 --- a/api/builder/build-docker.sh +++ b/api/builder/build-docker.sh @@ -16,11 +16,11 @@ fi # Add the --no-cache flag to force a rebuild. # Add the --progress=plain flag to show verbose output during the build. -# TODO use a different image name for different architectures docker build \ -f "${SCRIPT_DIR}/Dockerfile" \ --tag pbuf-compiler:latest \ --build-arg PROTOC_URL="${PROTOC_URL}" \ + --build-arg UID=$(id -u) \ . if [ $? -ne 0 ]; then