generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
22 lines (16 loc) · 931 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM amazoncorretto:17.0.13-alpine
# Uppdate dependencies and clear the dependency cache.
RUN apk update && apk -U upgrade && rm -rf /var/cache/apk/*
# Create and use a lower permission (non-root) user.
RUN adduser -S myLowPrivilegeUser
USER myLowPrivilegeUser
# 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/
# 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 service.
CMD ["java", "-jar", "/usr/local/bin/app.jar"]
# Inform Docker that this container listens on the specified port.
EXPOSE 8080