generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add comments describing why we are doing certain things
- Loading branch information
Showing
1 changed file
with
5 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |