/docker-java-multistage

Docker Java Multi-stage Builds

Primary LanguageJavaApache License 2.0Apache-2.0

Multi-stage Docker Build for Java Applications

This repository shows how to create a multi-stage Docker build for Java application.

Single-stage

  1. Build: docker image build -f Dockerfile.single -t people:singlestage .

  2. Run: docker container run -it -p 8080:8080 people:singlestage

  3. Access: curl http://localhost:8080/people/resources/persons

Multi-stage

  1. Build: docker image build -f Dockerfile -t people:multistage .

  2. Run: docker container run -it -p 8080:8080 people:multistage

  3. Access: curl http://localhost:8080/people/resources/persons