Skip to content
Snippets Groups Projects
Commit ccfb3173 authored by Jonas Leder's avatar Jonas Leder
Browse files

Cross compile docker for arm and arm64

parent bc986d75
No related branches found
No related tags found
No related merge requests found
Pipeline #6940 passed
docker-build: docker-build:
# Use the official docker image. image: gitlab.jonasled.de/jonasled/buildx-docker:latest
image: docker:latest
stage: build stage: build
services: services:
- docker:dind - docker:dind
before_script: before_script:
- docker context create build
- docker buildx create build --use
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - 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: script:
- | - |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
...@@ -17,8 +16,7 @@ docker-build: ...@@ -17,8 +16,7 @@ docker-build:
tag=":$CI_COMMIT_REF_SLUG" tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi fi
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . - docker buildx build --platform linux/amd64,linux/arm,linux/arm64 --push --tag "$CI_REGISTRY_IMAGE${tag}" .
- docker push "$CI_REGISTRY_IMAGE${tag}"
# Run this job in a branch where a Dockerfile exists # Run this job in a branch where a Dockerfile exists
rules: rules:
- if: $CI_COMMIT_BRANCH - if: $CI_COMMIT_BRANCH
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment