Result of the Getting Started with Micronaut and Graal - slightly extended so
- a GraalVM native image can be built using a "self-contained"
Dockerfilethat does not require to build or install anything locally and - to be compiled statically so a minimal (
scratch) docker base image can be used.
To build just run
docker build -t micronaut/getting-started .Then start the container with
docker run -i --rm -p 8080:8080 micronaut/getting-started
As of May 2019, the Micronaut getting started uses the frolvlad/alpine-glibc base image for the final image.
This repo provides a couple of other base images that compare as follows
| Base Image | Size | Shell | Package Manager | libc | Basic Linux Folders | Static Binary | Dockerfile |
|---|---|---|---|---|---|---|---|
| alpine-glibc | ☒ | ☒ | ☒ | ☒ | ☐ | 📄 | |
| distroless-static | ☐ | ☐ | ☐ | ☒ | ☒ | 📄 | |
| scratch | ☐ | ☐ | ☐ | ☐ | ☒ | 📄 |
Note that
- size is the compressed size within the DockerHub registry,
- if a shell is needed for debugging, you could just copy a statically compiled shell into the container, (except, of course, you're using a read-only filesystem):
docker run --rm --name micronaut-getting-started schnatterer/micronaut-getting-started
docker create --name busybox busybox
docker cp busybox:/bin/busybox busybox
docker cp busybox micronaut-getting-started:/busybox
docker exec -it micronaut-getting-started /busybox sh