Skip to content

Commit ba1953a

Browse files
committed
feat: added multi arch builds
1 parent 70a79f5 commit ba1953a

1 file changed

Lines changed: 49 additions & 2 deletions

File tree

.gitlab-ci.yml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
stages:
22
- test
33
- build
4+
- manifest
45

56
include:
67
- project: code0-tech/development/telescopium
@@ -49,12 +50,58 @@ build-docker:
4950
- .dind
5051
image: docker:29.4.1
5152
stage: build
53+
tags:
54+
- c0-$PLATFORM
5255
parallel:
5356
matrix:
5457
- C0_ACTION: !reference [.node-actions]
58+
PLATFORM: [amd64, arm64]
5559
- C0_ACTION: !reference [.rust-actions]
60+
PLATFORM: [amd64, arm64]
61+
before_script:
62+
- echo $C0_GH_TOKEN | docker login -u $ --password-stdin ghcr.io
63+
- docker context create build-context
64+
- docker buildx create --name container-builder --driver docker-container --bootstrap --use build-context
5665
script:
5766
- cd actions/$C0_ACTION
67+
- >
68+
docker buildx build
69+
-t ghcr.io/code0-tech/centaurus/ci-builds/$C0_ACTION:0.0.0-experimental-$CI_PIPELINE_ID-$CI_COMMIT_SHA
70+
--output type=registry,push-by-digest=true
71+
--metadata-file manifest-${CI_JOB_ID}.json
72+
.
73+
artifacts:
74+
paths:
75+
- actions/$C0_ACTION/manifest-*.json
76+
expire_in: 1 day
77+
78+
manifest-docker:
79+
extends:
80+
- .dind
81+
image: docker:29.4.1
82+
stage: manifest
83+
tags:
84+
- c0-amd64
85+
parallel:
86+
matrix:
87+
- C0_ACTION: !reference [.node-actions]
88+
- C0_ACTION: !reference [.rust-actions]
89+
needs:
90+
- job: build-docker
91+
parallel:
92+
matrix:
93+
- C0_ACTION: [ '$[[ matrix.C0_ACTION ]]' ]
94+
PLATFORM: [amd64, arm64]
95+
before_script:
96+
- apk add --no-cache jq
5897
- echo $C0_GH_TOKEN | docker login -u $ --password-stdin ghcr.io
59-
- docker build -t ghcr.io/code0-tech/centaurus/ci-builds/$C0_ACTION:0.0.0-experimental-$CI_PIPELINE_ID-$CI_COMMIT_SHA .
60-
- docker push ghcr.io/code0-tech/centaurus/ci-builds/$C0_ACTION:0.0.0-experimental-$CI_PIPELINE_ID-$CI_COMMIT_SHA
98+
script:
99+
- cd actions/$C0_ACTION
100+
- |
101+
refs=""
102+
for manifest in manifest-*.json; do
103+
name=$(jq -r '."image.name"' "$manifest")
104+
digest=$(jq -r '."containerimage.digest"' "$manifest")
105+
refs="$refs $name@$digest"
106+
done
107+
docker buildx imagetools create -t "ghcr.io/code0-tech/centaurus/ci-builds/$C0_ACTION:0.0.0-experimental-$CI_PIPELINE_ID-$CI_COMMIT_SHA" $refs

0 commit comments

Comments
 (0)