Update mutli-arch builds on docker hub

This commit is contained in:
ViViDboarder 2020-02-10 18:46:44 -08:00
parent 6d0ce9b6cf
commit e9d7ab64f5
2 changed files with 37 additions and 41 deletions

View File

@ -4,10 +4,41 @@
# "docker manifest" command isn't available yet on Docker Hub. # "docker manifest" command isn't available yet on Docker Hub.
TAG_ROOT=${DOCKER_TAG%-*} TAG_ROOT=${DOCKER_TAG%-*}
TARGET_ARCH=${DOCKER_TAG##*-} TARGET_ARCH=""
if [[ "$TARGET_ARCH" == "latest" ]]; then case "$DOCKER_TAG" in
echo "Building a non-arch tag. Skip manifest push" *amd64)
exit 0 TARGET_ARCH="amd64"
;;
*arm32v5)
TARGET_ARCH="arm32v5"
;;
*arm32v6)
TARGET_ARCH="arm32v6"
;;
*arm32v7)
TARGET_ARCH="arm32v7"
;;
*arm64v8)
TARGET_ARCH="arm64v8"
;;
*i386)
TARGET_ARCH="i386"
;;
*ppc64le)
TARGET_ARCH="ppc64le"
;;
*s390x)
TARGET_ARCH="s390x"
;;
*)
echo "Unknown target arch, skip manifest push"
exit 0
;;
esac
# If the tag is essentially only the arch, we use latest
if [[ "$TAG_ROOT" == "$TARGET_ARCH" ]]; then
TAG_ROOT="latest"
fi fi
curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.9.0/manifest-tool-linux-amd64 curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.9.0/manifest-tool-linux-amd64
@ -15,5 +46,5 @@ chmod +x manifest-tool
./manifest-tool push from-args \ ./manifest-tool push from-args \
--platforms "linux/$TARGET_ARCH" \ --platforms "linux/$TARGET_ARCH" \
--template "$DOCKER_REPO:${TAG_ROOT}-ARCH" \ --template "$DOCKER_REPO:$DOCKER_TAG" \
--target "$DOCKER_REPO:${TAG_ROOT}" --target "$DOCKER_REPO:$TAG_ROOT"

View File

@ -1,39 +1,4 @@
#!/bin/bash #!/bin/bash
set -ex set -ex
REPO=""
case "$DOCKER_TAG" in
*amd64)
REPO="library"
;;
*arm32v5)
REPO="arm32v5"
;;
*arm32v6)
REPO="arm32v6"
;;
*arm32v7)
REPO="arm32v7"
;;
*arm64v8)
REPO="arm64v8"
;;
*i386)
REPO="i386"
;;
*ppc64le)
REPO="ppc64le"
;;
*s390x)
REPO="s390x"
;;
*)
REPO="library"
;;
esac
[ "${REPO}" != "library" ] && \
{ echo 'qemu-user-static: Registration not required for current arch'; exit 0; }
docker run --rm --privileged multiarch/qemu-user-static:register --reset docker run --rm --privileged multiarch/qemu-user-static:register --reset