Skip to content
Snippets Groups Projects

FEAT(multi-arch): add support for multi arch

Closed Kay Effenberger requested to merge feat-multi-arch into main
1 file
+ 35
36
Compare changes
  • Side-by-side
  • Inline
+ 35
36
@@ -55,43 +55,42 @@ check_style:
- make lint
- make spell
docker-push:
# Use the docker image with buildx support for multi arch.
image: jonoh/docker-buildx-qemu
stage: release
variables:
# the name of the image without version
AURA_IMAGE_NAME: "autoradio/engine-recorder"
services:
- docker:dind
before_script:
# default repo is docker.io (aka docker hub)
- docker login -u "$DOCKER_ID" -p "$DOCKER_HUB_AUTH"
- docker buildx create --driver docker-container --use
- docker buildx inspect --bootstrap
script:
# Important: Ensures execution of other binary formats is enabled in the kernel
- update-binfmts --enable
# every commit on main branch should build image as unstable
# else it is from a tag (enforced by gitlab-ci rules)
# hint: tags are references independent of branches
- |
if [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]
then docker buildx build --platform linux/arm/v6,linux/arm64/v8,linux/amd64 -t $AURA_IMAGE_NAME:unstable --push.
else docker buildx build --platform linux/arm/v6,linux/arm64/v8,linux/amd64 -t $AURA_IMAGE_NAME -t $AURA_IMAGE_NAME:$CI_COMMIT_TAG --push.
fi
rules:
# - *release-rules
- if: $CI_COMMIT_TAG =~ /^\d+[.]\d+[.]\d+$/ || $CI_COMMIT_TAG =~ /^\d+[.]\d+[.]\d+[-]\S+$/
exists:
- Dockerfile
# every commit on master/main branch should trigger a push to docker-hub as unstable without a release
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
exists:
- Dockerfile
docker-push:
# Use the docker image with buildx support for multi arch.
image: jonoh/docker-buildx-qemu
stage: release
variables:
# the name of the image without version
AURA_IMAGE_NAME: "autoradio/engine-recorder"
services:
- docker:dind
before_script:
# default repo is docker.io (aka docker hub)
- docker login -u "$DOCKER_ID" -p "$DOCKER_HUB_AUTH"
- docker buildx create --driver docker-container --use
- docker buildx inspect --bootstrap
script:
# Important: Ensures execution of other binary formats is enabled in the kernel
- update-binfmts --enable
# every commit on main branch should build image as unstable
# else it is from a tag (enforced by gitlab-ci rules)
# hint: tags are references independent of branches
- |
if [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]
then docker buildx build --platform linux/arm/v6,linux/arm64/v8,linux/amd64 -t $AURA_IMAGE_NAME:unstable --push.
else docker buildx build --platform linux/arm/v6,linux/arm64/v8,linux/amd64 -t $AURA_IMAGE_NAME -t $AURA_IMAGE_NAME:$CI_COMMIT_TAG --push.
fi
rules:
# - *release-rules
- if: $CI_COMMIT_TAG =~ /^\d+[.]\d+[.]\d+$/ || $CI_COMMIT_TAG =~ /^\d+[.]\d+[.]\d+[-]\S+$/
exists:
- Dockerfile
# every commit on master/main branch should trigger a push to docker-hub as unstable without a release
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
exists:
- Dockerfile
release_job:
release_job:
stage: release
needs:
- docker-push
Loading