Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
Restored root privileges for the build stage.
  • Loading branch information
nhkhai committed May 1, 2024
1 parent 34417dc commit c72f143
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
# FROM eclipse-temurin:21-jdk-jammy as builder
FROM eclipse-temurin:21-jdk-alpine as builder

# Run the Docker container as a non-root user with user privileges instead of root privileges, since it helps mitigate risks.
RUN addgroup deploymentgroup; adduser --ingroup deploymentgroup --disabled-password deployment

# The USER instruction sets the preferred user name (or UID) and optionally the user group (or GID) while running the image — and for any subsequent RUN, CMD, or ENTRYPOINT instructions.
USER deployment

# The work directory.
# The build work directory.
WORKDIR /opt/app

# Copy the source code into the Docker image.
Expand Down Expand Up @@ -58,6 +52,7 @@ RUN addgroup deploymentgroup; adduser --ingroup deploymentgroup --disabled-pass
# The USER instruction sets the preferred user name (or UID) and optionally the user group (or GID) while running the image — and for any subsequent RUN, CMD, or ENTRYPOINT instructions.
USER deployment

# The deployment work directory.
WORKDIR /opt/app

# The environment port to expose.
Expand Down

0 comments on commit c72f143

Please sign in to comment.