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
2 files
+ 67
56
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 58
50
image: python:3.9
image: docker:stable
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_TLS_CERTDIR: ""
stages:
- test
@@ -19,6 +22,7 @@ stages:
- Dockerfile
run_test_cases:
image: python:3.9
stage: test
before_script:
- *install_requirements
@@ -31,6 +35,7 @@ run_test_cases:
junit: report.xml
check_coverage:
image: python:3.9
stage: test
needs: ["run_test_cases"]
before_script:
@@ -46,6 +51,7 @@ check_coverage:
path: coverage.xml
check_style:
image: python:3.9
stage: test
needs: ["run_test_cases"]
before_script:
@@ -54,53 +60,55 @@ check_style:
script:
- make lint
- make spell
# docker-push:
# # Use the official docker image.
# image: docker:latest
# 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"
# script:
# # 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 build -t $AURA_IMAGE_NAME:unstable .
# else docker build -t $AURA_IMAGE_NAME -t $AURA_IMAGE_NAME:$CI_COMMIT_TAG .
# fi
# # TODO: maybe isolate docker build and docker push
# - docker push "$AURA_IMAGE_NAME" --all-tags
# 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:
# stage: release
# needs:
# - docker-push
# image: registry.gitlab.com/gitlab-org/release-cli:latest
# rules:
# # - *release-rules
# - if: $CI_COMMIT_TAG =~ /^\d+[.]\d+[.]\d+$/ || $CI_COMMIT_TAG =~ /^\d+[.]\d+[.]\d+[-]\S+$/
# exists:
# - Dockerfile
# script:
# - echo "this will be a release when there is a tag, but tags should be protected to be only createable by maintainers."
# release:
# name: 'Release $CI_COMMIT_TAG'
# description: ./CHANGELOG
# tag_name: '$CI_COMMIT_TAG'
# ref: '$CI_COMMIT_TAG'
docker-push:
# Use the docker image with buildx support for multi arch.
image: jdrouet/docker-with-buildx:20.10.21-0.9.1
stage: release
variables:
# the name of the image without version
AURA_IMAGE_NAME: "autoradio/engine-recorder"
services:
- docker:20.10.21-dind
before_script:
# default repo is docker.io (aka docker hub)
- docker login -u "$DOCKER_ID" -p "$DOCKER_HUB_AUTH"
- docker buildx create --use
script:
# 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/v7,linux/arm64/v8,linux/amd64 -t $AURA_IMAGE_NAME:unstable .
else docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t $AURA_IMAGE_NAME -t $AURA_IMAGE_NAME:$CI_COMMIT_TAG .
fi
- docker push "$AURA_IMAGE_NAME" --all-tags
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:
stage: release
needs:
- docker-push
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
# - *release-rules
- if: $CI_COMMIT_TAG =~ /^\d+[.]\d+[.]\d+$/ || $CI_COMMIT_TAG =~ /^\d+[.]\d+[.]\d+[-]\S+$/
exists:
- Dockerfile
script:
- echo "this will be a release when there is a tag, but tags should be protected to be only createable by maintainers."
release:
name: 'Release $CI_COMMIT_TAG'
description: ./CHANGELOG
tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_TAG'
Loading