website/.gitlab-ci.yml

26 lines
915 B
YAML
Raw Normal View History

docker-build:
2022-02-21 09:51:38 +01:00
image: gitlab.jonasled.de/jonasled/buildx-docker:latest
2020-12-28 22:36:25 +01:00
stage: build
services:
- docker:dind
before_script:
2022-02-21 09:51:38 +01:00
- docker context create build
- docker buildx create build --use
2022-02-25 10:14:48 +01:00
- docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
2020-12-28 22:36:25 +01:00
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag=""
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
2022-02-21 09:51:38 +01:00
- 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:
2022-02-21 09:51:38 +01:00
- Dockerfile