Run twigs as user instead of root in docker image

This commit is contained in:
William Brawner 2021-12-18 07:44:01 -07:00
parent 6b606b86a9
commit b6ccae2abe

View file

@ -10,5 +10,8 @@ RUN /home/gradle/src/gradlew --console=plain --no-daemon shadowJar
FROM adoptopenjdk:openj9 FROM adoptopenjdk:openj9
EXPOSE 8080 EXPOSE 8080
COPY --from=builder /home/gradle/src/app/build/libs/twigs.jar twigs.jar RUN groupadd --system --gid 1000 twigs \
&& useradd --system --gid twigs --uid 1000 --create-home twigs
COPY --from=builder --chown=twigs:twigs /home/gradle/src/app/build/libs/twigs.jar twigs.jar
USER twigs
CMD /opt/java/openjdk/bin/java $JVM_ARGS -jar /twigs.jar CMD /opt/java/openjdk/bin/java $JVM_ARGS -jar /twigs.jar