Project · Beginner · about 10 hours
Containerise a service and ship it through CI
Package the orders API in a small, secure container image, run it with its database in Docker Compose, and build, test and scan it on every pull request.
Skills:CI/CD, Git and GitHub, Docker and containers, Automated testing
Part of: Software Engineer (Backend), DevOps / Platform Engineer
Data and licences
- Olist Brazilian E-Commerce Public Dataset (Kaggle) ↗CC BY-NC-SA 4.0 (non-commercial use, share alike)
Brief
Use the orders API from the Spring Boot project (or any small API you have built over the Olist data). A teammate should be able to run the whole stack with one command, and nothing should reach the main branch without passing tests.
What to build
Write a multi-stage Dockerfile: build in one stage, copy only the artifact into a slim runtime image, run as a non-root user.
Record the image size of a naive single-stage build and of your final build.
Compose file with PostgreSQL (with a volume and a health check), a one-off loader job and the API, which waits for the database to be healthy.
GitHub Actions: on pull requests run lint and tests, build the image, scan it (for example with Trivy) and fail on high-severity findings. On main, push the image to a registry with the commit SHA as the tag.
Protect the main branch so merges require the workflow to pass.
Deliverables
Repository with
Dockerfile,compose.yaml,.github/workflows/ci.ymlandREADME.md
How it is graded
Reviewers clone the repository, run docker compose up, and open a pull request that breaks a test to see CI block it.
Stretch
Add a dependency update bot and a workflow that runs the image with a smoke test before pushing it.
Deliverables
- A multi-stage Dockerfile producing a small image that runs as a non-root user
- A Docker Compose file with the API, PostgreSQL, a data loader and health checks
- A GitHub Actions workflow that lints, tests, builds the image and scans it for known vulnerabilities
- A README with one-command local setup and the image size before and after optimisation
How a reviewer grades it
| Criterion | Weight | What good looks like |
|---|---|---|
| Image is small, reproducible, non-root and has no secrets baked in | 25% | |
| Compose setup starts cleanly with health checks and dependency order | 20% | |
| CI runs on pull requests, fails on test or scan failures, and caches dependencies | 35% | |
| README lets a new teammate run everything in minutes | 20% |