And all shooting some b-ball outside of the school

This commit is contained in:
Henning Bocklage 2020-06-06 00:18:32 +02:00
parent 46054a37e0
commit e3806eb687
3 changed files with 67 additions and 6 deletions

View File

@ -4,6 +4,7 @@ services:
stages:
- build
- post
variables:
IMAGE: registry.gitlab.com/bockiii/deemix-docker
@ -18,11 +19,12 @@ build:
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
- docker build --pull -f Dockerfile.arm64v8 -t $IMAGE:arm64v8 .
- docker push $IMAGE:arm64v8
- docker build --pull -f Dockerfile.arm32v7 -t $IMAGE:armhf .
- docker push $IMAGE:armhf
- docker build --pull -f Dockerfile.arm32v7 -t $IMAGE:arm32v7 .
- docker push $IMAGE:arm32v7
- docker build --pull -t $IMAGE:amd64 .
- docker push $IMAGE:amd64
- docker manifest create $IMAGE $IMAGE:amd64 $IMAGE:armhf $IMAGE:arm64v8
- docker manifest annotate $IMAGE $IMAGE:armhf --os linux --arch arm
- docker manifest annotate $IMAGE $IMAGE:arm64v8 --os linux --arch arm64
- docker manifest push $IMAGE
manifest:
stage: post
script:
- ./post-push

16
manifest.yaml Normal file
View File

@ -0,0 +1,16 @@
image: registry.gitlab.com/bockiii/deemix-docker:latest
manifests:
- image: registry.gitlab.com/bockiii/deemix-docker:amd64
platform:
architecture: amd64
os: linux
- image: registry.gitlab.com/bockiii/deemix-docker:arm32v7
platform:
architecture: arm
os: linux
variant: v7
- image: registry.gitlab.com/bockiii/deemix-docker:arm64v8
platform:
architecture: arm64
os: linux
variant: v8

43
post_push Normal file
View File

@ -0,0 +1,43 @@
#!/bin/bash
# Autobuild the Image on Docker Hub with advanced options
# https://docs.docker.com/docker-hub/builds/advanced/
# if the host is not equal to the building system architecture, set the image arch with manifest correctly on docker hub.
set -e
#IMAGE_OS=$(uname | tr '[:upper:]' '[:lower:]')
IMAGE_OS="linux"
HOST_ARCH=$(uname -m)
HOST_ARCH_ALIAS=$([[ "${HOST_ARCH}" == "x86_64" ]] && echo "amd64" || echo "${HOST_ARCH}")
BUILD_ARCH=$(echo "${DOCKERFILE_PATH}" | cut -d '.' -f 2)
BUILD_ARCH=$([[ "${BUILD_ARCH}" == *\/* ]] && echo "${BUILD_ARCH}" | rev | cut -d '/' -f 1 | rev || echo "${BUILD_ARCH}")
QEMU_USER_STATIC_ARCH=$([[ "${BUILD_ARCH}" == "armhf" ]] && echo "${BUILD_ARCH::-2}" || echo "${BUILD_ARCH}")
PLATFORMS_ARCH=$([[ "${QEMU_USER_STATIC_ARCH}" == "arm" ]] && echo "${IMAGE_OS}/${QEMU_USER_STATIC_ARCH},${IMAGE_OS}/${QEMU_USER_STATIC_ARCH}64,${IMAGE_OS}/${HOST_ARCH_ALIAS}" || echo "${IMAGE_OS}/${QEMU_USER_STATIC_ARCH}")
echo "PLATFORMS-ARCH: ${PLATFORMS_ARCH}"
if [[ "${HOST_ARCH}" == "${QEMU_USER_STATIC_ARCH}"* || "${BUILD_ARCH}" == "Dockerfile" ]]; then
echo "Building ${BUILD_ARCH} image natively; No manifest needed for current arch."
exit 0
else
# Manifest
# docker manifest: https://docs.docker.com/engine/reference/commandline/manifest/
echo "docker manifest (not working with autobuild on docker hub)"
#docker manifest create "${IMAGE_NAME}" "${IMAGE_NAME}"
#docker manifest annotate "${IMAGE_NAME}" "${IMAGE_NAME}" --os "${IMAGE_OS}" --arch "${QEMU_USER_STATIC_ARCH}"
#docker manifest push "${IMAGE_NAME}"
# manifest-tool: https://github.com/estesp/manifest-tool
echo "manifest-tool"
# prerelease:
#MANIFEST_TOOL_VERSION=$(curl -s https://api.github.com/repos/estesp/manifest-tool/tags | grep 'name.*v[0-9]' | head -n 1 | cut -d '"' -f 4)
# release:
MANIFEST_TOOL_VERSION=$(curl -s https://api.github.com/repos/estesp/manifest-tool/releases/latest | grep 'tag_name' | cut -d\" -f4)
curl -L https://github.com/estesp/manifest-tool/releases/download/$MANIFEST_TOOL_VERSION/manifest-tool-$IMAGE_OS-$HOST_ARCH_ALIAS -o manifest-tool
chmod +x manifest-tool
#./manifest-tool push from-args --platforms ${PLATFORMS_ARCH} --template ${IMAGE_NAME} --target ${IMAGE_NAME}
./manifest-tool push from-spec manifest.yaml
fi