Update gitlab CI/CD to build multi-arch

This commit is contained in:
Deon George 2023-05-17 20:56:56 +10:00
parent a54183b4be
commit 5ce358e414
2 changed files with 21 additions and 3 deletions

View File

@ -1,23 +1,31 @@
stages: stages:
- build - build
- build-manifest
variables: variables:
DOCKER_HOST: tcp://docker:2375
VERSION: latest VERSION: latest
DOCKER_HOST: tcp://docker:2375
VERSIONARCH: ${VERSION}-${ARCH} VERSIONARCH: ${VERSION}-${ARCH}
cache:
key: ${CI_JOB_NAME_SLUG}-${CI_COMMIT_REF_SLUG}
paths:
- build-cache
image: docker:latest image: docker:latest
services: services:
- docker:dind - docker:dind
before_script: before_script:
- if [ ! -d build-cache ]; then mkdir build-cache; fi - if [ ! -d build-cache ]; then mkdir build-cache; fi
- sed -ie s'/https/http/' /etc/apk/repositories - sed -i -e s'/https/http/' /etc/apk/repositories
- HTTP_PROXY=http://proxy.dege.lan:3128 apk add git curl - HTTP_PROXY=http://proxy.dege.lan:3128 apk add git curl
- docker info && docker version - docker info && docker version
# env|sort # env|sort
# docker login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" "$CI_SERVER_HOST"
- echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin - echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
include: include:
- .gitlab-docker-x86_64.yml - .gitlab-docker-x86_64.yml
# .gitlab-docker-armv7l.yml
# .gitlab-docker-arm64.yml
- .gitlab-docker-manifest.yml

View File

@ -0,0 +1,10 @@
x86_64:build-manifest:
stage: build-manifest
script:
- docker manifest create ${CI_REGISTRY_IMAGE}:${VERSION} ${CI_REGISTRY_IMAGE}:${VERSION}-x86_64 #${CI_REGISTRY_IMAGE}:${VERSION}-arm64 ${CI_REGISTRY_IMAGE}:${VERSION}armv7l
- docker manifest push --purge ${CI_REGISTRY_IMAGE}:${VERSION}
tags:
- docker
- x86_64
only:
- master