Skip to content

Commit

Permalink
add comments describing why we are doing certain things
Browse files Browse the repository at this point in the history
  • Loading branch information
halprin committed Aug 27, 2024
1 parent 69f2114 commit d1cfe1f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
# Use Linux-Alpine image
FROM amazoncorretto:17.0.12-alpine

RUN apk update && apk -U upgrade && rm -rf /var/cache/apk/*

RUN adduser -S myLowPrivilegeUser
USER myLowPrivilegeUser

ARG JAR_LIB_FILE=./app/build/libs/app-all.jar

# Create directory and switch to it
# Set the workdir to a location that the running application can write to
# which is in the myLowPrivilegeUser home folder because we are running as that user instead of root.
WORKDIR /home/myLowPrivilegeUser/app/

# Add application JAR to created folder
COPY --chown=myLowPrivilegeUser ${JAR_LIB_FILE} /usr/local/bin/app.jar
# Copy the jar file into /usr/local/bin/ because it seemingly needs to go to a location that any user can access.
# If we put the jar file into the myLowPrivilegeUser's home directly, the container fails to run in Azure.
COPY --chown=myLowPrivilegeUser ./app/build/libs/app-all.jar /usr/local/bin/app.jar

# Run the api
CMD ["java", "-jar", "/usr/local/bin/app.jar"]

# Use port 8080
EXPOSE 8080

0 comments on commit d1cfe1f

Please sign in to comment.