Skip to content

Commit

Permalink
Dockerfile-ubuntu: use same UID/GID
Browse files Browse the repository at this point in the history
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
  • Loading branch information
openedev committed Aug 14, 2024
1 parent c56d364 commit 60dbedd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Dockerfile-ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,15 @@ RUN apt-get update && apt-get install -y \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash build
RUN usermod -aG sudo build
RUN echo "build ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/build
# Accept USER_ID and GROUP_ID as arguments to create a user with the same UID/GID as on the host
ARG USER_ID=1000
ARG GROUP_ID=1000

# Create a new group and user with the specified UID/GID
RUN groupadd -g ${GROUP_ID} build && \
useradd -m -u ${USER_ID} -g build build && \
usermod -aG sudo build && \
echo "build ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/build

USER build
WORKDIR /home/build

0 comments on commit 60dbedd

Please sign in to comment.