Skip to content

Instantly share code, notes, and snippets.

@amolpednekar
Created March 13, 2019 12:05
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 amolpednekar/56d572ab346a0d320a6e06ea25438ceb to your computer and use it in GitHub Desktop.
Save amolpednekar/56d572ab346a0d320a6e06ea25438ceb to your computer and use it in GitHub Desktop.
Multi-stage docker build - JVM
# Stage 1 (to create a "build" image, ~140MB)
FROM maven:3.5-jdk-8-alpine AS builder
COPY . /usr/src/todolist-spring-boot-backend/
WORKDIR /usr/src/todolist-spring-boot-backend/
RUN mvn package
# Stage 2 (to create a downsized "container executable", ~87MB)
FROM openjdk:8-jre-alpine3.7
WORKDIR /root/
COPY --from=builder /usr/src/todolist-spring-boot-backend/target/todoapp-0.0.1-SNAPSHOT.jar .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment