Skip to content

Commit

Permalink
Use same UID inside and oustide container.
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <[email protected]>
  • Loading branch information
cody-littley committed Oct 7, 2024
1 parent 4f6e25b commit 6e4fe46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion api/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/builder/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6e4fe46

Please sign in to comment.