Java 11 app on Docker
This is a follow up article for Java 8 app on Docker.
Using openjdk:11
Create Dockerfile as
FROM adoptopenjdk:11-jre-hotspotCOPY target/demo-0.0.1-SNAPSHOT.jar /usr/app/WORKDIR /usr/appENTRYPOINT ["java","-jar","demo-0.0.1-SNAPSHOT.jar"]
Image created is heavy and would be about 250MB (excluding your jar file size).
Using alpine:latest
Create Dockerfile as
FROM alpine:latestRUN apk update && \apk add --upgrade openjdk11-jre-headlessCOPY target/emergency-0.0.1-SNAPSHOT.jar /usr/app/emergency.jarWORKDIR /usr/appENTRYPOINT ["java","-jar","emergency.jar"]
This creates an image that is about 200MB (excluding your jar file size).
Creating image and running it
Create image
docker build -t demo-spring-boot-app:0.0.1 .
Comments
Post a Comment