forked from GoogleCloudPlatform/cloud-code-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
24 lines (19 loc) · 798 Bytes
/
Dockerfile
File metadata and controls
24 lines (19 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Use the official maven/Java 11 image to create a build artifact.
# https://hub.docker.com/_/maven
FROM maven:3-jdk-11-slim AS build-env
# Set the working directory to /app
WORKDIR /app
# Copy the pom.xml file to download dependencies
COPY pom.xml ./
# Copy local code to the container image.
COPY src ./src
# Download dependencies and build a release artifact.
RUN mvn package -DskipTests
# Use OpenJDK for base image.
# https://hub.docker.com/_/openjdk
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM openjdk:11.0.16-jre-slim
# Copy the jar to the production image from the builder stage.
COPY --from=build-env /app/target/hello-world-*.jar /hello-world.jar
# Run the web service on container startup.
CMD ["java", "-jar", "/hello-world.jar"]