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: ...@@ -4,21 +4,27 @@ stages:
- build - build
test docker: test docker:
# Use the official docker image.
image: docker:latest
stage: test stage: test
image: registry.griefed.de/prosper/docker-with-buildx:latest
services: services:
- docker:dind - name: docker:dind
alias: docker
variables:
project_name: $CI_PROJECT_NAME
SEMANTIC_RELEASE_PACKAGE: $CI_PROJECT_NAME
before_script: before_script:
- docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_TOKEN" docker.io
- 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) - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# All other branches are tagged with the escaped branch name (commit ref slug) - docker buildx create --use --name grfdbuilder
script: script:
- docker build -t "$CI_REGISTRY_IMAGE:develop" -t "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:develop" . - docker pull "$CI_REGISTRY_IMAGE:develop"
- docker push "$CI_REGISTRY_IMAGE:develop" "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:develop" - docker buildx build
# Run this job in a branch where a Dockerfile exists --push
only: --platform linux/amd64,linux/arm/v7,linux/arm64
- master --cache-from "$CI_REGISTRY_IMAGE:develop"
--tag "$CI_REGISTRY_IMAGE:develop"
--tag "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:develop" .
except: except:
refs: refs:
- tags - tags
...@@ -45,20 +51,28 @@ release: ...@@ -45,20 +51,28 @@ release:
variables: variables:
- $CI_COMMIT_TITLE =~ /^RELEASE:.+$/ - $CI_COMMIT_TITLE =~ /^RELEASE:.+$/
build docker: build:
stage: build stage: build
# Use the official docker image. image: registry.griefed.de/prosper/docker-with-buildx:latest
image: docker:latest
services: services:
- docker:dind - name: docker:dind
alias: docker
variables:
project_name: $CI_PROJECT_NAME
SEMANTIC_RELEASE_PACKAGE: $CI_PROJECT_NAME
before_script: before_script:
- docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_TOKEN" docker.io - docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_TOKEN" docker.io
- 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) - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# All other branches are tagged with the escaped branch name (commit ref slug) - docker buildx create --use --name grfdbuilder
script: script:
- docker build -t "$CI_REGISTRY_IMAGE:latest" -t "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:latest" . - docker pull "$CI_REGISTRY_IMAGE:latest"
- docker push "$CI_REGISTRY_IMAGE:latest" "index.docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO:latest" - docker buildx build
# Run this job in a branch where a Dockerfile exists --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: only:
- tags - 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