BM: Baca dalam Bahasa Melayu
World C2: Container Pipelines
Build an image in Actions
You will learn: how the belt packs your app into an image on every push.
Checked with GitHub Actions 2026-10 on 31 Oct 2026
The problem
Aina packed the Kedai Kancil image on her laptop. Ben packed one on his. They act differently. Which pack should the shop trust?
Pick one answer.
Watch
Pick an event. Press Run and watch the line.
A push to main starts the belt. Station 1 sets up Buildx. Station 2 builds the image kedai-kancil:ci. Both turn green.
Workflow file .github/workflows/image.yml
name: Image on: push: branches: [main] pull_request: permissions: contents: read jobs: image: runs-on: ubuntu-latest steps: - uses: docker/setup-buildx-action@v4 - uses: docker/build-push-action@v7 with: tags: kedai-kancil:ci
The line
Push to main · main
Press Run. A fresh worker packs a frozen meal pack: your image. Every push, the same way.
Watch
Tap the line that starts the packing machine.
0 of 1 found
Buildx: The packing machine: Docker's builder. It can save the layer cache and build for many CPU types. is Docker’s packing machine. setup-buildx-action starts it on the runner. Then build-push-action uses it to pack your image.
Predict
There is no actions/checkout step. How does the build get your code?
Pick one answer.
Try it
Your turn. Build the image on every push to main and every PR.
Tap blocks to add them. Put them in order.
Blocks
Your workflow
Tap a block above to start.
Workflow file .github/workflows/
name: Image
What runs
Nothing to run yet.
Hint
When, token, where, then two steps: Buildx first, then the build.Check
The job is done. What stays, and what is gone?
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now make the belt build your image on every push.
Go deeper (optional)
build-push-action reads your code straight from Git, at this commit. Files made by earlier steps are not in it. Need them? Add a checkout step and context: . to the build.
Real rep (optional). Use a public practice repo with a Dockerfile, never a work repo.
Real mission
git add .github && git commit -m "Build image in CI" && git push
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
Aina bungkus image (pek beku) Kedai Kancil di laptopnya. Ben bungkus satu lagi di laptop dia. Kedua-duanya berkelakuan lain. Pek mana yang kedai patut percaya?
Tekan Run. Pekerja baru bungkus pek makanan beku: image anda. Setiap push, cara yang sama.
Buildx ialah mesin pembungkus Docker. setup-buildx-action hidupkannya di runner. Kemudian build-push-action gunanya untuk bungkus image anda.
Tiada langkah actions/checkout. Macam mana build dapat kod anda?
Giliran anda. Bina image pada setiap push ke main dan setiap PR.
Job dah selesai. Apa yang kekal, dan apa yang hilang?
Kini anda boleh suruh tali sawat bina image anda pada setiap push.
You finished this before. Practice is always welcome!
Official docs: Docker docs: GitHub Actions · docker/build-push-action · docker/setup-buildx-action
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?