Skip to content

Commit

Permalink
Use root account as initial step
Browse files Browse the repository at this point in the history
  • Loading branch information
jcardozo committed Sep 15, 2024
1 parent 82ea92f commit b43c24e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ FROM jetpackio/devbox:latest
# Set the DEVBOX_USER environment variable
ENV DEVBOX_USER=devbox-user

# Ensure we are using root to perform operations that require elevated permissions
USER root:root

# Create a new user 'devbox-user' and ensure the user has appropriate permissions on the working directory
RUN groupadd -r ${DEVBOX_USER} && \
useradd -r -g ${DEVBOX_USER} -d /code -s /bin/bash ${DEVBOX_USER} && \
useradd -r -g ${DEVBOX_USER} -d /code -s /bin/bash ${DEVBOX_USER}

# Set up the working directory and permissions
WORKDIR /code
USER root:root
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code

# Switch to the devbox user
Expand Down

0 comments on commit b43c24e

Please sign in to comment.