The shop ships as a Docker image, built from its Dockerfile. Build it in the pipeline, and every change gets its image built the same way, on a clean machine.
GitHub's runners come with Docker. A job checks out the code, then builds, only once the tests pass:
image:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: docker build -t registry.monster.market/shop:${{ github.sha }} .registry.monster.market/shop is where the image will live, once a later lesson pushes it there.
The tag is ${{ github.sha }}: in a push's run, the full hash of the commit that was pushed. A tag like latest is reused by every build, so it can't tell you what's inside. A commit's hash names exactly one version of the code: git show <hash> shows it.
Sam's branch goblin-sale fails its tests. With needs: test, broken code never becomes an image. Check it: switch to the branch, merge main into it, push.
Objectives
- Build the image.
- No image from broken code.