Working proof-of-concept for a multi-architecture Docker image build #201
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Self contained POC for a full multi-architecture Docker image build for the following architectures:
linux/386
linux/amd64
linux/arm/v6
linux/arm/v7
linux/arm64
The current, tested, build is available here:
https://github.com/vicchi/pg_tileserv/pkgs/container/pg_tileserv
. This image was built and tested on an AMD Ryzen 9 5900X running Ubuntu 22.04 and then tested on an Intel Core i7-8700K, also running Ubuntu 22.04, a Raspberry Pi 4 Model B, a Raspberry Pi 3 Model B and a MacBook Pro with an M1 Pro running macOS 14.2.1 Sonoma.This isn't production ready inasmuch as it's not integrated into the current
Makefile
orDockerfile
/Dockerfile.alpine
nor is it integrated in the Actions CI pipeline. Instead I've isolated this inMakefile.multiarch
andDockerfile.multiarch
for comment and review. I'm more than happy to re-issue this PR with all of this merged into the current build pipeline if it passes muster.Currently the build is configured by a
.env
(see.env.sample
for a template) containing the PAT, GitHub user and Registry URL and requires Dockerbuildx
to be pre-installed, which should be the case with the latest Docker version (24.0.7 according to my main build server).Key build targets are:
build
- spins up abuildx
builder and then builds for all configured architectures, pushes to the container repo and tags aslatest
rebuild
- as for build but ignores the build cacherelease
- tags the image in the container repo with the commit hash atHEAD
and the current released version (read from./VERSION
)lint
- useshadolint/hadolint
to sanity check theDockerfile.multiarch
There's several previous requests for this sort of image build as well as one which looks to have been merged and subsequently backed out; see #69, #72, #127 for context and history.