Complete Lab 6 for QuickNotes: containerize the app, run it with Compose and persistence, and apply the bonus hardening defaults.
- Task 1: Add a multi-stage distroless Dockerfile with a static stripped Go binary, nonroot runtime, and image size under 25 MB.
- Task 2:
Add
compose.yamlwith port publishing, named volume persistence, env vars, restart policy, and a distroless-compatible healthcheck. - Bonus:
Harden the
quicknotesservice withcap_drop: [ALL],read_only: true,tmpfs: /tmp, andno-new-privileges; document Docker and Trivy verification insubmissions/lab6.md.
go test ./...docker build -t quicknotes:lab6 ./appdocker run --rm -p 8080:8080 -v "$PWD/app/data:/data" quicknotes:lab6andcurl /healthdocker compose up --build -d, POST note, verify persistence acrossdown/up, verify reset withdown -vdocker inspectchecks for nonroot, dropped capabilities, read-only root, andno-new-privilegesdocker compose exec quicknotes shfails as expectedtrivy image --severity HIGH,CRITICAL quicknotes:lab6
- Title is a clear sentence (≤ 70 chars)
- Commits are signed (
git log --show-signature) -
submissions/labN.mdupdated