Cleanup dockerfile

This commit is contained in:
Mark Nellemann 2023-03-01 13:48:35 +01:00
parent b9db5b3472
commit bd417b1efa

View file

@ -1,15 +1,12 @@
### ###
### Stage 1 - Builder Container ### Stage 1 - Build Container
### ###
FROM eclipse-temurin:17-jdk as builder FROM eclipse-temurin:17-jdk as builder
# Install build requirements # Copy our application sourcecode into the container
#RUN apk update && apk add --no-cache cargo WORKDIR /tmp/app/
COPY . /tmp/app/
# Copy our application sourcecode to the container
WORKDIR /tmp/java/
COPY . /tmp/java/
# Build our application from the sourcecode # Build our application from the sourcecode
RUN ./gradlew clean build 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 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 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 # Instructions for running our application
USER nobody USER nobody
EXPOSE 8080/tcp
WORKDIR /opt/app WORKDIR /opt/app
CMD ["java", "-jar", "/opt/app/hello.jar"] CMD ["java", "-jar", "/opt/app/hello.jar"]