Skip to content

Build and publish the Docker image with GitHub Actions - #2

Merged
xcompass merged 1 commit into
masterfrom
ci/build-image-with-actions
Oct 21, 2026
Merged

xcompass merged 1 commit into
masterfrom
ci/build-image-with-actions

Conversation

@xcompass

Copy link
Copy Markdown
Member

Why

Docker Hub autobuilds for ubcctlt/response-map have been broken for years. Both Docker Hub webhooks on this repo fail on every push (403 and 502), and the last automated image is latest from 2018. 1.0.0–1.0.3 were all built and pushed by hand.

What

New workflow .github/workflows/docker-image.yml:

  • Push to master / pull requests: build the linux/amd64 image and smoke-test it. Nothing is published.
  • Git tag push (e.g. 1.0.4): same build and test, then push ubcctlt/response-map:<tag>, the tag the deployment config pins. It uses the org secrets DOCKER_HUB_USERNAME / DOCKER_HUB_ACCESS_TOKEN, the same ones compair, moodle-docker, etc. use.
  • Smoke test, run before any push: php -v; check that mysqli, gd, imagick and Zend OPcache load; php -l on every PHP file; start the container and check that Apache answers with X-Powered-By: PHP/….
  • latest is not moved (flavor: latest=false). Deployments pin release tags.
  • Hardening: contents: read token; checkout doesn't persist credentials; every action pinned to a commit SHA with its version in a comment.

Also:

  • .dockerignore: exclude .github/. Otherwise COPY . would put the workflow file in the public web root.
  • README.md: a short "Releasing a Docker image" section.

Test plan

  • actionlint (with shellcheck): no issues
  • Smoke-test script, extracted verbatim from the workflow, passes against a fresh amd64 build (PHP 8.5.12, 18 files linted, Apache serves PHP)
  • Smoke test fails as expected on a missing extension and on a PHP syntax error
  • .github/ is not in the built image
  • This PR's own workflow run passes on GitHub's runners
  • First real tag push after merge publishes ubcctlt/response-map:<tag> (the push path can't run from a PR)

After merge

  • Delete the two dead Docker Hub webhooks on this repo (ids 69152217, 90674326).
  • Someone with ubcctlt org access on Docker Hub should turn off autobuild for ubcctlt/response-map.

Docker Hub autobuilds stopped working long ago (both webhooks on this
repo fail with 403/502), so images have been built and pushed by hand.

The workflow builds and smoke-tests the image on every push to master
and every PR. Pushing a git tag also publishes
ubcctlt/response-map:<tag>. The smoke test checks the PHP version, the
mysqli/gd/imagick/OPcache extensions, php -l on every file, and that
Apache serves PHP. The old `latest` tag is left alone.

Also exclude .github/ from the image so the workflow file isn't served
from the web root, and document the release steps in the README.
@xcompass
xcompass merged commit a86474a into master Oct 21, 2026
2 checks passed
@xcompass
xcompass deleted the ci/build-image-with-actions branch October 21, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant