Add multi-arch Docker build workflow (amd64, arm64, armv7)#710
Add multi-arch Docker build workflow (amd64, arm64, armv7)#710guidoffm wants to merge 2 commits into
Conversation
Add a GitHub Actions workflow that builds the Dockerfile for linux/amd64, linux/arm64 and linux/arm/v7 and publishes the resulting signed image to ghcr.io/guidoffm/vzlogger on master pushes and v*.*.* tags. PRs build but do not push. QEMU + Buildx cross-build non-host architectures on the amd64 runner; GHA cache speeds incremental rebuilds; workflow_dispatch allows ad-hoc rebuilds. All action pins are Node.js 24 compatible. Also opened against upstream as volkszaehler#710.
Build the existing Dockerfile for linux/amd64, linux/arm64 and
linux/arm/v7 - covering the platforms vzlogger is most commonly
deployed on - and publish the resulting image to GHCR.
Triggers and tag policy:
- `push` of a v*.*.* tag is the only event that publishes to the
registry. Pull requests build the image (so changes that break
the Dockerfile fail CI) but do not push, and `workflow_dispatch`
on a non-tag ref also builds without publishing.
- `metadata-action` is configured explicitly so a release tag
produces :{{version}}, :{{major}}.{{minor}} and :latest, with
:latest tied to the highest release tag (not to whatever master
happens to be). `flavor: latest=false` suppresses the default
auto-`latest`-on-default-branch behaviour.
Other choices:
- QEMU + Buildx are used to cross-build non-host architectures
on the amd64 runner.
- The image is signed with cosign via the GitHub OIDC identity -
no long-lived secret required.
- GitHub Actions cache (type=gha) speeds incremental rebuilds.
Action pins use the current major versions, all of which support
Node.js 24 (GitHub forces Node 24 from 2026-06-16 and removes
Node 20 entirely on 2026-09-16).
Companion to the new docker-build workflow: - Add compose.yaml as the canonical run-from-image example, mounting only vzlogger.conf instead of overlaying /etc, with a clear placeholder for the meter's /dev/serial/by-id path and an opt-in port mapping for the local HTTP API. - Rewrite the README's Docker section to lead with the prebuilt multi-arch image (ghcr.io/volkszaehler/vzlogger:latest, signed with cosign) and `docker compose up`, keeping the local build path documented for development. The previous remark that `docker build` would pull source from upstream was incorrect - the Dockerfile copies the local checkout - and has been dropped.
f6a2d55 to
31343f9
Compare
| devices: | ||
| # Replace with the persistent path of your meter's USB serial | ||
| # adapter. You can pass multiple device entries if needed. | ||
| - /dev/serial/by-id/usb-FTDI_FT230X_Basic_UART_XXXXXXXX-if00-port0 |
There was a problem hiding this comment.
should we maybe rather encourage to use variables for this than hardcode it?
https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/
There was a problem hiding this comment.
The compose file is only an example and replaced the docker read command, but it is easier to read. Of course someone can introduce environment variables.
|
the github workflow definition file looks like it's largely boilerplate code copied from somewhere can you include a pointer to where it's taken from, |
It is AI generated. No need to re-invent. Before AI I used to copy the file from a blueprint project. The most important thing is that the build is multi platform and the image could be executed everywhere. |
Summary
Add a GitHub Actions workflow that builds the existing
Dockerfilefor the three architectures vzlogger is most commonly deployed on, and publishes the resulting image to GHCR.linux/amd64,linux/arm64,linux/arm/v7— covers regular x86_64 hosts, modern Raspberry Pi 4/5, and the still-popular 32-bit Pi 2B/3.ubuntu-latestrunner via QEMU + Buildx.ghcr.io/${{ github.repository }}only onmasterpushes andv*.*.*tags — PRs build but do not push (security-by-default).type=gha) makes incremental rebuilds fast.workflow_dispatchis included so maintainers can trigger an ad-hoc rebuild without waiting for the daily cron.All action pins use floating major versions that are Node.js 24 compatible (Node 20 actions are forced off after 2026-09-16).
Validation
Verified end-to-end on my fork: same workflow file built
amd64 + arm64 + armv7green in ~5min with cache hits, and published a signed multi-arch manifest toghcr.io/guidoffm/vzlogger. PR with the green run: guidoffm#1Notes for maintainers
IMAGE_NAME: ${{ github.repository }}→ publishes toghcr.io/volkszaehler/vzlogger. If you'd prefer a different registry path (e.g. Docker Hubvolkszaehler/vzlogger), only theREGISTRY/IMAGE_NAMEenv vars and the login secrets need changing.schedule:cron (26 23 * * *) was carried over from the GitHub starter template — happy to drop it if you'd rather rebuild only on changes.Test plan
Dockerworkflow via thepull_requesteventmasterrun pushes the image toghcr.io/volkszaehler/vzlogger:masterand signs it