Cleanup dockerfile

This commit is contained in:
Mark Nellemann 2023-03-01 13:48:35 +01:00
parent b9db5b3472
commit bd417b1efa
1 changed files with 7 additions and 12 deletions

View File

@ -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"]