diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..bd792fcf1f52c861a0cdd5d8438fbf4ea16d6154 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,22 @@ +build-docker: + # Use the official docker image. + image: gitlab.jonasled.de/jonasled/buildx-docker:latest + retry: 2 + stage: build + services: + - docker:dind + before_script: + - docker context create build + - docker buildx create build --use + - docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + # Default branch leaves tagempty (= latest tag) + # All other branches are tagged with the escaped branch name (commit ref slug) + script: + - | + if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then + tag="latest" + else + tag="$CI_COMMIT_REF_SLUG" + fi + - docker buildx build --platform linux/arm,linux/arm64,linux/amd64 --push --tag "$CI_REGISTRY_IMAGE:${tag}" .