Implement Lab 6 containerization and hardening for QuickNotes#1209
Open
smairon wants to merge 5 commits into
Open
Implement Lab 6 containerization and hardening for QuickNotes#1209smairon wants to merge 5 commits into
smairon wants to merge 5 commits into
Conversation
Signed-off-by: smairon <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Complete Lab 6 for QuickNotes: containerize the app, run it with Compose and persistence, and apply the bonus hardening defaults.
Changes
Add a multi-stage distroless Dockerfile with a static stripped Go binary, nonroot runtime, and image size under 25 MB.
Add
compose.yamlwith port publishing, named volume persistence, env vars, restart policy, and a distroless-compatible healthcheck.Harden the
quicknotesservice withcap_drop: [ALL],read_only: true,tmpfs: /tmp, andno-new-privileges; document Docker and Trivy verification insubmissions/lab6.md.Testing
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:lab6Checklist
git log --show-signature)submissions/lab6.mdupdated