BM: Baca dalam Bahasa Melayu
World D5: Ship & Shield · Boss challenge
Publish safely
You will learn: to publish a non-root image with an SBOM to GHCR, with zero critical holes.
Checked with Docker Engine 29 on 31 Oct 2026
The problem
Your laptop~/kedai-api
- No open hatches
Lunchboxes (containers)
- No containers yet
Frozen packs (images)
- kedai-api:1.06 layers · 244MB
- node:24-alpine4 layers · 244MB
0 containers (0 running), 2 images, 0 lockers.
Boss: publish Kedai’s API to GHCR. Three rules: not root, an SBOM inside, zero CRITICAL holes. Room 1 first: the pack still runs as root.
Try it
Room 1: add USER node to the end of the recipe. Then build kedai-api:1.0 again.
Your laptop~/kedai-api
- No open hatches
Lunchboxes (containers)
- No containers yet
Frozen packs (images)
- kedai-api:1.06 layers · 244MB
- node:24-alpine4 layers · 244MB
0 containers (0 running), 2 images, 0 lockers.
Hint
echo "USER node" >> Dockerfile, then docker build -t kedai-api:1.0 .Check
Room 2: your rule is zero CRITICAL. Sort each finding from last night’s scan.
Drag a card into a box. Or tap the card, then tap the box.
Watch
Your API pack, scanned for real. Exit code 0: zero CRITICAL holes. Rule 3 holds.
Try it
Room 3: ship it to GHCR. Your GitHub token is in $CR_PAT. Log in with it, then tag and push.
Your laptop~/kedai-api
- No open hatches
Lunchboxes (containers)
- No containers yet
Frozen packs (images)
- kedai-api:1.06 layers · 244MB
- node:24-alpine4 layers · 244MB
0 containers (0 running), 2 images, 0 lockers.
Hint
Token login first (--password-stdin), then docker tag and docker push.Check
Room 4: the pack must carry its ingredients list. Build the one command that builds, labels and pushes.
Tap the pieces in the right order.
Try it
Final room, for real, with your Kedai Kancil API (Mission 1).
Real mission
read -s CR_PAT && export CR_PATecho $CR_PAT | docker login ghcr.io -u YOUR-NAME --password-stdindocker buildx build --sbom=true --provenance=mode=max -t ghcr.io/YOUR-NAME/kedai-kancil-api:1.0.0 --push .trivy image --severity CRITICAL --exit-code 1 ghcr.io/YOUR-NAME/kedai-kancil-api:1.0.0git tag v1.0.0 && git push origin v1.0.0
0 of 6 steps done · Your ticks are saved.
Check
GitHub’s public API can see your repo and its tags. It cannot see packages without a login.
Check it on GitHub
- Your kedai-kancil repo is publicNot checked yet
- It has a version tag, like v1.0.0Not checked yet
Check
Check the rest yourself.
Self-check
docker inspect -f '{{.Config.User}}' ghcr.io/YOUR-NAME/kedai-kancil-api:1.0.0docker buildx imagetools inspect ghcr.io/YOUR-NAME/kedai-kancil-api:1.0.0
0 of 4 steps done · Your ticks are saved.
You did it!
You can now publish a safe, labelled image to a registry.
Bahasa Melayu
Boss: terbitkan API Kedai Kancil ke GHCR. Tiga peraturan: bukan root, ada SBOM, sifar lubang CRITICAL. Bilik 1 dulu: pek itu masih jalan sebagai root.
Bilik 1: tambah USER node di hujung resepi. Kemudian bina kedai-api:1.0 semula.
echo "USER node" >> Dockerfile, kemudian docker build -t kedai-api:1.0 .Bilik 2: peraturan anda ialah sifar CRITICAL. Asingkan setiap penemuan daripada imbasan semalam.
Pek API anda, diimbas betul-betul. Kod keluar 0: sifar lubang CRITICAL. Peraturan 3 dipenuhi.
Bilik 3: hantar ke GHCR. Token GitHub anda ada dalam $CR_PAT. Log masuk dengannya, kemudian tag dan push.
--password-stdin), kemudian docker tag dan docker push.Bilik 4: pek itu mesti bawa senarai bahannya. Bina satu arahan yang bina, labelkan dan push.
Bilik terakhir, betul-betul, dengan API Kedai Kancil anda (Misi 1).
API awam GitHub boleh nampak repo dan tag anda. Ia tak nampak pakej tanpa log masuk.
Semak yang selebihnya sendiri.
Kini anda boleh terbitkan image yang selamat dan berlabel ke registry.
You finished this before. Practice is always welcome!
Official docs: GitHub: the Container registry · Build attestations · Trivy · Dockerfile USER
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?