feat(ci): build multi-arch iamge
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter 2023-07-17 16:03:15 +00:00
parent f7a2959b50
commit 7c92ce1a8f

View file

@ -1,7 +1,10 @@
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: default name: amd64
platform:
arch: amd64
steps: steps:
- name: Build image - name: Build image
@ -11,13 +14,68 @@ steps:
- | - |
echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $GITEA_USER $GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $GITEA_USER $GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json
/kaniko/executor \ /kaniko/executor \
--destination code.icb4dc0.de/buildr/docs:latest \ --destination "$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_$${IMAGE_TAG}" \
--destination code.icb4dc0.de/buildr/docs:$DRONE_COMMIT_SHA \ --context "$${BUILD_CONTEXT}"
--context .
environment: environment:
GITEA_USER: prskr GITEA_USER: prskr
GITEA_TOKEN: GITEA_TOKEN:
from_secret: gitea_token from_secret: gitea_token
IMAGE_REPO: code.icb4dc0.de/buildr/docs
IMAGE_TAG: x86_64
BUILD_CONTEXT: .
---
kind: pipeline
type: docker
name: arm64
platform:
arch: arm64
steps:
- name: Build image
image: gcr.io/kaniko-project/executor:debug
network_mode: host
commands:
- |
echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $GITEA_USER $GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json
/kaniko/executor \
--destination "$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_$${IMAGE_TAG}" \
--context "$${BUILD_CONTEXT}"
environment:
GITEA_USER: prskr
GITEA_TOKEN:
from_secret: gitea_token
IMAGE_REPO: code.icb4dc0.de/buildr/docs
IMAGE_TAG: arm64
BUILD_CONTEXT: .
---
kind: pipeline
type: docker
name: deploy
depends_on:
- amd64
- arm64
steps:
- name: manifest
image: quay.io/buildah/stable
network_mode: host
privileged: true
commands:
- buildah login "$${IMAGE_REGISTRY}" --username "$${GITEA_USER}" --password "$${GITEA_TOKEN}"
- buildah manifest create "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}"
- buildah manifest add "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" "docker://$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_x86_64"
- buildah manifest add "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" "docker://$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_arm64"
- buildah manifest push --all "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" "docker://$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}"
environment:
GITEA_USER: prskr
GITEA_TOKEN:
from_secret: gitea_token
IMAGE_REGISTRY: code.icb4dc0.de
IMAGE_REPO: buildr/docs
- name: Deploy docs - name: Deploy docs
image: code.icb4dc0.de/prskr/ci-images/kustomize:latest image: code.icb4dc0.de/prskr/ci-images/kustomize:latest