Skip to content

Instantly share code, notes, and snippets.

@recursivecodes
Created July 1, 2019 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save recursivecodes/3393b146c6ca259f237f28690ddb6b13 to your computer and use it in GitHub Desktop.
Save recursivecodes/3393b146c6ca259f237f28690ddb6b13 to your computer and use it in GitHub Desktop.
Dockerfile
# 1st stage, build the app
FROM maven:3.5.4-jdk-9 as build
WORKDIR /helidon
# Create a first layer to cache the "Maven World" in the local repository.
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -DskipTests
# Do the Maven build!
# Incremental docker builds will resume here when you change sources
ADD src src
RUN mvn package -DskipTests
RUN echo "done!"
# 2nd stage, build the runtime image
FROM openjdk:8-jre-slim
WORKDIR /helidon
# Copy the binary built in the 1st stage
COPY --from=build /helidon/target/user-svc.jar ./
COPY --from=build /helidon/target/libs ./libs
CMD ["java", "-jar", "user-svc.jar"]
EXPOSE 8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment