deemix-docker/.gitlab-ci.yml
2021-06-28 23:09:55 +02:00

37 lines
1.5 KiB
YAML

image: docker:latest
services:
- docker:dind
stages:
- build
variables:
IMAGE: registry.gitlab.com/bockiii/deemix-docker
IMAGE_TAG: latest
DOCKER_CLI_EXPERIMENTAL: enabled
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- apk add --update curl && rm -rf /var/cache/apk/*
- export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
build:
stage: build
script:
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
- docker build --pull -f Dockerfile.arm64v8 --build-arg BUILDDATE=$CI_JOB_TIMESTAMP -t $IMAGE:arm64v8-${IMAGE_TAG} .
- docker build --pull -f Dockerfile.arm32v7 --build-arg BUILDDATE=$CI_JOB_TIMESTAMP -t $IMAGE:arm32v7-${IMAGE_TAG} .
- docker build --pull --build-arg BUILDDATE=$CI_JOB_TIMESTAMP -t $IMAGE:amd64-${IMAGE_TAG} .
- docker push $IMAGE:arm64v8-${IMAGE_TAG}
- docker push $IMAGE:arm32v7-${IMAGE_TAG}
- docker push $IMAGE:amd64-${IMAGE_TAG}
- docker manifest create "$IMAGE:${IMAGE_TAG}"
"$IMAGE:amd64-${IMAGE_TAG}"
"$IMAGE:arm32v7-${IMAGE_TAG}"
"$IMAGE:arm64v8-${IMAGE_TAG}"
- docker manifest annotate "$IMAGE:${IMAGE_TAG}" "$IMAGE:arm32v7-${IMAGE_TAG}" --os=linux --arch=arm --variant=v7
- docker manifest annotate "$IMAGE:${IMAGE_TAG}" "$IMAGE:arm64v8-${IMAGE_TAG}" --os=linux --arch=arm64 --variant=v8
# Push manifest to official registry
- docker manifest push "$IMAGE:${IMAGE_TAG}"
# Validate multi-arch manifest
- docker run --rm mplatform/mquery $IMAGE:${IMAGE_TAG}