#5950 Pulling up user creation in Dockerfile for layer caching

In case of rebuilding an image, the create user command would run again before, as it came after the more volatile commands for adding dependencies and runner.
This commit is contained in:
Gunnar Morling
2019-12-07 14:37:56 +01:00
parent de21598535
commit 9c94c629c6

View File

@@ -17,15 +17,18 @@
FROM fabric8/java-alpine-openjdk8-jre:1.6.5
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV AB_ENABLED=jmx_exporter
COPY ${build_dir}/lib/* /deployments/lib/
COPY ${build_dir}/*-runner.jar /deployments/app.jar
EXPOSE 8080
# run with user 1001 and be prepared for be running in OpenShift too
# Be prepared for running in OpenShift too
RUN adduser -G root --no-create-home --disabled-password 1001 \
&& chown -R 1001 /deployments \
&& chmod -R "g+rwX" /deployments \
&& chown -R 1001:root /deployments
COPY ${build_dir}/lib/* /deployments/lib/
COPY ${build_dir}/*-runner.jar /deployments/app.jar
EXPOSE 8080
# run with user 1001
USER 1001
ENTRYPOINT [ "/deployments/run-java.sh" ]
ENTRYPOINT [ "/deployments/run-java.sh" ]