Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.1 KB

README.md

File metadata and controls

34 lines (25 loc) · 1.1 KB

Docker cache for multi-module Maven project

This project demonstrates how to write a multi-stage Dockerfile for a multi-module Maven project, so that Maven dependencies are cached in the early Docker layers of a builder stage and also how to use a layered JAR to create cache layers in the final Docker image.

In this project the user-app module depends on a common module.

Using BuildKit

DOCKER_BUILDKIT='1' docker build \
    -t pgpb/user-app:local \
    -f docker/user-app.dockerfile . \
    && docker run -it pgpb/user-app:local

Without BuildKit

docker build \
    -t pgpb/user-app:local \
    -f docker/user-app.dockerfile . \
    && docker run -it pgpb/user-app:local

References