-
Notifications
You must be signed in to change notification settings - Fork 166
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
Add Workflow for Multi-Architecture Docker Image Build, Push, and Manifest Management #535
base: develop
Are you sure you want to change the base?
Conversation
@Bcoderx6 I gave some reviews, please have a look. |
@@ -14,7 +14,9 @@ concurrency: | |||
cancel-in-progress: true | |||
|
|||
env: | |||
IMAGE_NAME: index.docker.io/metacall/core | |||
DOCKER_REGISTRY: docker.io | |||
DOCKER_USERNAME: metacall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker username is a secret that must be provided by GitHub secrets.
@@ -70,95 +60,140 @@ jobs: | |||
env: | |||
METACALL_PLATFORM: ${{ matrix.platform }} | |||
run: | | |||
export DOCKER_BUILDKIT=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all those environment variables are already set in the script.
run: | | ||
for tag in "deps" "dev" "runtime" "cli"; do | ||
docker manifest create ${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} \ | ||
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-amd64 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you transform all those commands in a for using the matrix.platform as an array?
DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
run: | | ||
platforms=("linux-amd64" "linux-arm64" "linux-riscv64" "linux-ppc64le" "linux-s390x" "linux-386" "linux-arm-v7" "linux-arm-v6") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, can't you get this directly from matrix.platform?
@viferga, I’ve fixed those issues. Please have a look. |
I was also thinking about something like this:
Then we can replace all the:
By something like:
But we need to do |
This PR introduces a comprehensive GitHub Actions workflow to build, push, and manage Docker images for multiple architectures, ensuring broad platform support and seamless integration. Key features include:
Trigger Conditions:
Executes on push and pull_request events for branches (master, develop, and feature/**) and tags matching the pattern v*...
Implements concurrency to prevent overlapping runs for the same workflow or pull request.
Workflow Steps:
Build Stage:
Leverages QEMU and BuildX to enable cross-platform builds.
Constructs Docker images for eight platforms, including linux/amd64, linux/arm64, and others.
Tags images with platform-specific suffixes.
Push Stage:
Pushes the platform-specific images to Docker Hub.
Manifest Management:
Creates and pushes multi-architecture manifest lists for key tags (deps, dev, runtime, cli).
Includes support for version-specific tags derived from GitHub tag references.
Maintains a latest tag pointing to the CLI image.
Testing Stage:
Validates the CLI image by creating a test Dockerfile that runs a basic script using metacallcli.
Tests across all supported architectures.
Cleanup Stage:
Removes platform-specific tags from Docker Hub after manifest creation to minimize clutter.
Environment Variables:
Centralizes key variables like Docker registry, username, image name, and BuildKit version for easier management.
Secrets Management:
Securely uses DOCKER_HUB_USERNAME and DOCKER_HUB_ACCESS_TOKEN for authentication.
Notes:
This workflow ensures compatibility across a wide range of platforms, facilitates efficient Docker image management, and automates testing and cleanup. It lays the foundation for scalable and robust multi-architecture Docker builds.
@viferga