mirror of
https://github.com/bensuperpc/dockcross.git
synced 2026-07-25 20:42:29 +02:00
Merge pull request #911 from thewtex/buildah-manifest-tool
ci: push multi-arch images with manifest-tool
This commit is contained in:
@@ -1547,6 +1547,13 @@ jobs:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASS }}
|
||||
|
||||
- name: Install manifest-tool
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
wget https://github.com/estesp/manifest-tool/releases/latest/download/binaries-manifest-tool.tar.gz -O - | tar -xz
|
||||
sudo cp manifest-tool-linux-amd64 /usr/local/bin/manifest-tool
|
||||
sudo chmod +x /usr/local/bin/manifest-tool
|
||||
|
||||
- name: deploy-multi-arch
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Common values: docker, podman, buildah
|
||||
DOCKER := $(or $(OCI_EXE), docker)
|
||||
BUILD_DOCKER := $(or $(BUILD_DOCKER), $(DOCKER))
|
||||
BUILDAH := $(or $(BUILDAH_EXE), buildah)
|
||||
MANIFEST_TOOL := $(or $(MANIFEST_TOOL_EXE), manifest-tool)
|
||||
RM = --rm
|
||||
|
||||
# Name of the docker-equivalent executable for running test containers.
|
||||
@@ -382,16 +382,17 @@ $(addsuffix .push,$(STANDARD_IMAGES) $(NON_STANDARD_IMAGES)): $$(basename $$@)
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(addsuffix .manifest,$(MULTIARCH_IMAGES) web-wasi-threads web-wasm): $$(basename $$@)
|
||||
if $(BUILDAH) manifest exists $(ORG)/$(basename $@); then \
|
||||
$(BUILDAH) manifest rm $(ORG)/$(basename $@); fi
|
||||
$(BUILDAH) manifest create $(ORG)/$(basename $@)
|
||||
$(BUILDAH) manifest add $(ORG)/$(basename $@) docker://$(ORG)/$(basename $@):latest-amd64
|
||||
$(BUILDAH) manifest add $(ORG)/$(basename $@) docker://$(ORG)/$(basename $@):latest-arm64
|
||||
$(MANIFEST_TOOL) push from-args \
|
||||
--platforms linux/amd64,linux/arm64 \
|
||||
--template $(ORG)/$(basename $@):latest-ARCH \
|
||||
--target $(ORG)/$(basename $@):latest
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(addsuffix .push,$(MULTIARCH_IMAGES) web-wasi-threads web-wasm): $$(basename $$@).manifest
|
||||
$(BUILDAH) manifest push --all --format v2s2 $(ORG)/$(basename $@) docker://$(ORG)/$(basename $@):latest
|
||||
$(BUILDAH) manifest push --all --format v2s2 $(ORG)/$(basename $@) docker://$(ORG)/$(basename $@):$(TAG)
|
||||
$(MANIFEST_TOOL) push from-args \
|
||||
--platforms linux/amd64,linux/arm64 \
|
||||
--template $(ORG)/$(basename $@):$(TAG)-ARCH \
|
||||
--target $(ORG)/$(basename $@):$(TAG)
|
||||
|
||||
#
|
||||
# testing prerequisites implicit rule
|
||||
|
||||
@@ -620,6 +620,14 @@ Note that the architecture is now `aarch64` instead of `amd64`, so it runs nativ
|
||||
|
||||
\-\--
|
||||
|
||||
## Multi-architecture Image Creation
|
||||
|
||||
For creating multi-architecture container images, this project uses [manifest-tool](https://github.com/estesp/manifest-tool) to create and manage manifest lists that combine platform-specific images into a single multi-platform reference. This allows container runtimes to automatically select the appropriate image based on the target architecture.
|
||||
|
||||
The multi-architecture images are built on different architectures (amd64 and arm64) and then combined using manifest-tool's `push from-args` command, which creates manifest lists pointing to the individual platform-specific images.
|
||||
|
||||
---
|
||||
|
||||
Credits:
|
||||
|
||||
- [sdt/docker-raspberry-pi-cross-compiler](https://github.com/sdt/docker-raspberry-pi-cross-compiler), who invented the base of the **dockcross** script.
|
||||
|
||||
Reference in New Issue
Block a user