From bd417b1efa80929de2d1c592aa3b4070816b00a5 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Wed, 1 Mar 2023 13:48:35 +0100 Subject: [PATCH] Cleanup dockerfile --- Dockerfile | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index e57a50c..a727066 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,12 @@ ### -### Stage 1 - Builder Container +### Stage 1 - Build Container ### FROM eclipse-temurin:17-jdk as builder -# Install build requirements -#RUN apk update && apk add --no-cache cargo - -# Copy our application sourcecode to the container -WORKDIR /tmp/java/ -COPY . /tmp/java/ +# Copy our application sourcecode into the container +WORKDIR /tmp/app/ +COPY . /tmp/app/ # Build our application from the sourcecode RUN ./gradlew clean build @@ -17,18 +14,16 @@ RUN ./gradlew clean build ### -### Stage 1 - Runtime Container +### Stage 2 - Runtime Container ### FROM eclipse-temurin:17-jre-ubi9-minimal as runtime -# Install runtime requirements -#RUN apk update && apk add --no-cache libgcc - # Copy our binary artifact from the previous building stage -COPY --from=builder /tmp/java/build/libs/hello-*-all.jar /opt/app/hello.jar +COPY --from=builder /tmp/app/build/libs/hello-*-all.jar /opt/app/hello.jar # Instructions for running our application USER nobody +EXPOSE 8080/tcp WORKDIR /opt/app CMD ["java", "-jar", "/opt/app/hello.jar"]