Skip to content
Snippets Groups Projects
Commit 27b88741 authored by Griefed's avatar Griefed :joystick:
Browse files

Update .gitlab-ci.yml file

parent 4c3a8114
No related branches found
No related tags found
No related merge requests found
......@@ -4,21 +4,27 @@ stages:
- build
test docker:
# Use the official docker image.
image: docker:latest
stage: test
image: registry.griefed.de/prosper/docker-with-buildx:latest
services:
- docker:dind
- name: docker:dind
alias: docker
variables:
project_name: $CI_PROJECT_NAME
SEMANTIC_RELEASE_PACKAGE: $CI_PROJECT_NAME
before_script:
- docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_TOKEN" docker.io
- 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)
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker buildx create --use --name grfdbuilder
script:
- docker build -t "$CI_REGISTRY_IMAGE:develop" -t "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:develop" .
- docker push "$CI_REGISTRY_IMAGE:develop" "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:develop"
# Run this job in a branch where a Dockerfile exists
only:
- master
- docker pull "$CI_REGISTRY_IMAGE:develop"
- docker buildx build
--push
--platform linux/amd64,linux/arm/v7,linux/arm64
--cache-from "$CI_REGISTRY_IMAGE:develop"
--tag "$CI_REGISTRY_IMAGE:develop"
--tag "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:develop" .
except:
refs:
- tags
......@@ -45,20 +51,28 @@ release:
variables:
- $CI_COMMIT_TITLE =~ /^RELEASE:.+$/
build docker:
build:
stage: build
# Use the official docker image.
image: docker:latest
image: registry.griefed.de/prosper/docker-with-buildx:latest
services:
- docker:dind
- name: docker:dind
alias: docker
variables:
project_name: $CI_PROJECT_NAME
SEMANTIC_RELEASE_PACKAGE: $CI_PROJECT_NAME
before_script:
- docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_TOKEN" docker.io
- 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)
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker buildx create --use --name grfdbuilder
script:
- docker build -t "$CI_REGISTRY_IMAGE:latest" -t "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:latest" .
- docker push "$CI_REGISTRY_IMAGE:latest" "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:latest"
# Run this job in a branch where a Dockerfile exists
- docker pull "$CI_REGISTRY_IMAGE:latest"
- docker buildx build
--push
--platform linux/amd64,linux/arm/v7,linux/arm64
--cache-from "$CI_REGISTRY_IMAGE:latest"
--tag "$CI_REGISTRY_IMAGE:latest"
--tag "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:$CI_COMMIT_TAG"
--tag "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:latest" .
only:
- tags
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment