mirror of
https://git.netzspielplatz.de/docker-multiarch/prosody.git
synced 2025-11-08 15:49:27 +00:00
maybe we have some image tagging now!
This commit is contained in:
parent
47d9a72e43
commit
8d462cf78b
1 changed files with 37 additions and 6 deletions
|
|
@ -6,7 +6,8 @@ variables:
|
|||
DOCKER_TLS_CERTDIR: ""
|
||||
stages:
|
||||
- buildx
|
||||
- deploy
|
||||
- build
|
||||
- push
|
||||
|
||||
buildx:
|
||||
image: docker:19-git
|
||||
|
|
@ -24,9 +25,9 @@ buildx:
|
|||
- git clone git://github.com/docker/buildx ./docker-buildx
|
||||
- docker build --platform=local -o . ./docker-buildx
|
||||
|
||||
deploy:
|
||||
build:
|
||||
image: docker:19
|
||||
stage: deploy
|
||||
stage: build
|
||||
services:
|
||||
- name: docker:19-dind
|
||||
command: ["--experimental"]
|
||||
|
|
@ -35,11 +36,41 @@ deploy:
|
|||
- mv buildx ~/.docker/cli-plugins/docker-buildx
|
||||
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
variables:
|
||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
- docker buildx create --use --name mybuilder
|
||||
- docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --push -t $IMAGE_TAG .
|
||||
- docker pull $IMAGE_TAG
|
||||
- docker tag $IMAGE_TAG $CI_REGISTRY_IMAGE:latest
|
||||
|
||||
Push latest:
|
||||
variables:
|
||||
# We are just playing with Docker here.
|
||||
# We do not need GitLab to clone the source code.
|
||||
GIT_STRATEGY: none
|
||||
stage: push
|
||||
only:
|
||||
# Only "main" should be tagged "latest"
|
||||
- main
|
||||
script:
|
||||
# Because we have no guarantee that this job will be picked up by the same runner
|
||||
# that built the image in the previous step, we pull it again locally
|
||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
# Then we tag it "latest"
|
||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:latest
|
||||
# Annnd we push it.
|
||||
- docker push $CI_REGISTRY_IMAGE:latest
|
||||
|
||||
# Finally, the goal here is to Docker tag any Git tag
|
||||
# GitLab will start a new pipeline everytime a Git tag is created, which is pretty awesome
|
||||
Push tag:
|
||||
variables:
|
||||
# Again, we do not need the source code here. Just playing with Docker.
|
||||
GIT_STRATEGY: none
|
||||
stage: push
|
||||
only:
|
||||
# We want this job to be run on tags only.
|
||||
- tags
|
||||
script:
|
||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue