This repository demonstrates an optimized multi-stage Docker build
based on a generic Linux distribution (debian:bookworm-slim).
The project compiles a small C program in a dedicated builder stage, and runs the final binary in a lightweight runtime stage as a non-root user.
- Multi-stage Docker build
- Static C binary compilation
- Non-root runtime user
- Clean Debian base image
- GitHub Actions CI with:
- Docker build
- Container run test
- Output validation
docker build -t docker-multistage-example .
docker run --rm docker-multistage-example
Expected output:
Hello from multi-stage Docker build on Debian!
The workflow automatically triggers on:
- any push
- any pull request
It performs:
- Docker build
- Program execution inside container
- Output verification
- Pass/fail result
You can inspect it under:
.github/workflows/docker-ci.yml
docker-multistage-example/ │
├── Dockerfile
├── src/
│ └── hello.c
├── .github/
│ └── workflows/
│ | └── docker-ci.yml
└── README.md
- Demonstrates advanced Docker multi-stage techniques
- Shows build optimization and image size reduction
- Highlights secure container practices (non-root user)
- Includes automated CI pipeline
- Great for DevOps / Cloud / Platform Engineering portfolios
Gaetano Vespero
DevOps & Automation Engineer | Specialist in CI/CD + AI Workflow Integration