Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working proof-of-concept for a multi-architecture Docker image build #201

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vicchi
Copy link

@vicchi vicchi commented Jan 7, 2024

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 or Dockerfile/Dockerfile.alpine nor is it integrated in the Actions CI pipeline. Instead I've isolated this in Makefile.multiarch and Dockerfile.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 Docker buildx 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 a buildx builder and then builds for all configured architectures, pushes to the container repo and tags as latest
  • rebuild - as for build but ignores the build cache
  • release - tags the image in the container repo with the commit hash at HEAD and the current released version (read from ./VERSION)
  • lint - uses hadolint/hadolint to sanity check the Dockerfile.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.

@pramsey
Copy link
Collaborator

pramsey commented Jan 7, 2024

@crunchyheath can you review and make sure we can use these builds and still get the right images we need off the repo?

@pramsey
Copy link
Collaborator

pramsey commented Jan 14, 2024

@vicchi I appreciate this PR! We (crunchy) have some internal requirements for our build and handling of container making, so we are attacking this slightly differently, and we'd be interested in hearing your feedback on CrunchyData/pg_featureserv#154 to make sure that all your requirements are met by the reworking too.

@vicchi
Copy link
Author

vicchi commented Jan 14, 2024

@pramsey Just taken a look at CrunchyData/pg_featureserv#154 and it's definitely a different approach but all I can really add is it looks good (and will also be a good source of reference for what I assume it a CI based image build).

My requirements are pretty basic; currently I take the pg_tileserv image, wrap it in a custom Dockerfile to add a health check and that derived image is then spun up as multiple tile servers via Docker compose; one per PostgreSQL/PostGIS environment in RDS.

Deployment wise, all our "servers" are X86_64 EC2 instance but my team run on macOS and I'm trialling being able to allow them to deploy our full container stack on their local machines, hence the multi-architecture approach in this PR.

As long as I can pull down a container that supports Intel/AMD and Apple Silicon/ARM then I'm happy 😄

@pramsey
Copy link
Collaborator

pramsey commented Jan 18, 2024

As long as I can pull down a container that supports Intel/AMD and Apple Silicon/ARM then I'm happy

Do you know if ARM64 meets that bar or do the specific Apple variants need targets?

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.

2 participants