Skip to content

Commit

Permalink
Fixing user permissions for Docker file
Browse files Browse the repository at this point in the history
Co-authored-by: halprin <halprin@users.noreply.github.com>
  • Loading branch information
jcrichlake and halprin committed Aug 26, 2024
1 parent b7ae4d6 commit bbe3ba4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Use Linux-Alpine image
FROM amazoncorretto:17.0.12-alpine

RUN apk -U upgrade
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
WORKDIR /app
WORKDIR /home/myLowPrivilegeUser/app/

# Add application JAR to created folder
COPY ${JAR_LIB_FILE} app.jar
COPY --chown=myLowPrivilegeUser ${JAR_LIB_FILE} app.jar

# Run the api
CMD ["java", "-jar", "app.jar"]
Expand Down

0 comments on commit bbe3ba4

Please sign in to comment.