diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 40ba810c2904907ad521657269fbd39458b4541b..ee5c8f81bf79176a8cee23e838ff76e71ad1169b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,12 @@ docker-build: - # Use the official docker image. - image: docker:latest + image: gitlab.jonasled.de/jonasled/buildx-docker:latest stage: build services: - docker:dind before_script: + - docker context create build + - docker buildx create build --use - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - # Default branch leaves tag empty (= latest tag) - # All other branches are tagged with the escaped branch name (commit ref slug) script: - | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then @@ -17,10 +16,9 @@ docker-build: tag=":$CI_COMMIT_REF_SLUG" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" fi - - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . - - docker push "$CI_REGISTRY_IMAGE${tag}" + - docker buildx build --platform linux/amd64,linux/arm,linux/arm64 --push --tag "$CI_REGISTRY_IMAGE${tag}" . # Run this job in a branch where a Dockerfile exists rules: - if: $CI_COMMIT_BRANCH exists: - - Dockerfile \ No newline at end of file + - Dockerfile