Skip to content

Commit

Permalink
Simplify Dockerfile, remove superfluous steps
Browse files Browse the repository at this point in the history
Removed unnecessary user creation and environment variable settings to reduce complexity. Preserved essential commands to maintain functionality and ensure the proper setup of the working directory and package installations. CMD at the end of the script is deleted and will be moved to devcontainer.json.
  • Loading branch information
jcardozo committed Sep 16, 2024
1 parent b43c24e commit cdca497
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# Using the official Devbox image as the base
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}

# Set up the working directory and permissions
WORKDIR /code
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
Expand All @@ -23,6 +13,4 @@ COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json /code/devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock /code/devbox.lock

# Run devbox command to install packages based on the lock file
RUN devbox run -- echo "Installed Packages."

CMD ["/bin/sh", "-c", "devbox shell && mvn spring-boot:run"]
RUN devbox run -- echo "Installed Packages."

0 comments on commit cdca497

Please sign in to comment.