hellomicronaut/Dockerfile

30 lines
602 B
Docker
Raw Normal View History

2023-03-01 11:12:12 +00:00
###
2023-03-01 12:48:35 +00:00
### Stage 1 - Build Container
2023-03-01 11:12:12 +00:00
###
FROM eclipse-temurin:17-jdk as builder
2023-03-01 12:48:35 +00:00
# Copy our application sourcecode into the container
WORKDIR /tmp/app/
COPY . /tmp/app/
2023-03-01 11:12:12 +00:00
# Build our application from the sourcecode
RUN ./gradlew clean build
###
2023-03-01 12:48:35 +00:00
### Stage 2 - Runtime Container
2023-03-01 11:12:12 +00:00
###
FROM eclipse-temurin:17-jre-ubi9-minimal as runtime
# Copy our binary artifact from the previous building stage
2023-03-01 12:48:35 +00:00
COPY --from=builder /tmp/app/build/libs/hello-*-all.jar /opt/app/hello.jar
2023-03-01 11:12:12 +00:00
# Instructions for running our application
USER nobody
2023-03-01 12:48:35 +00:00
EXPOSE 8080/tcp
2023-03-01 11:12:12 +00:00
WORKDIR /opt/app
CMD ["java", "-jar", "/opt/app/hello.jar"]