Last active
November 22, 2019 10:42
-
-
Save tonit/6061c9895e615297407b4aa41ae28a75 to your computer and use it in GitHub Desktop.
This is an example of turning a potentially more complex build into a docker build which is very repeatable and ready to be used in cloud build engines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM maven:3.5-jdk-8-alpine as builder | |
# Copy local code to the container image. | |
WORKDIR /app | |
COPY pom.xml . | |
COPY src ./src | |
# Build a release artifact. | |
RUN mvn package -DskipTests | |
FROM adoptopenjdk/openjdk8:jdk8u202-b08-alpine-slim | |
# Copy the jar to the production image from the builder stage. | |
COPY --from=builder /app/target/helloworld-*.jar /helloworld.jar | |
# Run the web service on container startup. | |
CMD ["java","-Djava.security.egd=file:/dev/./urandom","-Dserver.port=${PORT}","-jar","/helloworld.jar"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment