World map

 

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.

What happened on GitHub

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.

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

      1. git add .github && git commit -m "Build image in CI" && git push

      0 of 4 steps done · Your ticks are saved.