mirror of
https://git.netzspielplatz.de/docker-multiarch/prosody.git
synced 2025-11-08 18:39:24 +00:00
changed to the current one-stage default ci config
This commit is contained in:
parent
e6d77c4e27
commit
147c416d26
1 changed files with 13 additions and 49 deletions
|
|
@ -1,16 +1,15 @@
|
|||
image: docker:19
|
||||
image: docker:19.03
|
||||
services:
|
||||
- docker:19-dind
|
||||
- docker:19.03-dind
|
||||
variables:
|
||||
DOCKER_DRIVER: overlay
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
stages:
|
||||
- buildx
|
||||
- build
|
||||
- push
|
||||
- deploy
|
||||
|
||||
buildx:
|
||||
image: docker:19-git
|
||||
image: docker:19.03-git
|
||||
stage: buildx
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
|
|
@ -19,63 +18,28 @@ buildx:
|
|||
- buildx
|
||||
expire_in: 1 hour
|
||||
services:
|
||||
- docker:19-dind
|
||||
- docker:19.03-dind
|
||||
script:
|
||||
- export DOCKER_BUILDKIT=1
|
||||
- git clone git://github.com/docker/buildx ./docker-buildx
|
||||
- docker build --platform=local -o . ./docker-buildx
|
||||
|
||||
build:
|
||||
image: docker:19
|
||||
stage: build
|
||||
deploy:
|
||||
image: docker:19.03
|
||||
stage: deploy
|
||||
services:
|
||||
- name: docker:19-dind
|
||||
- name: docker:19.03-dind
|
||||
command: ["--experimental"]
|
||||
before_script:
|
||||
- mkdir -p ~/.docker/cli-plugins
|
||||
- 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_NAME
|
||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
||||
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 .
|
||||
|
||||
Push latest:
|
||||
services:
|
||||
- name: docker:19-dind
|
||||
command: ["--experimental"]
|
||||
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:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
# 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 --platform linux/amd64,linux/arm64,linux/arm/v7 $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
# Then we tag it "latest"
|
||||
- docker tag --platform linux/amd64,linux/arm64,linux/arm/v7 $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:latest
|
||||
# Annnd we push it.
|
||||
- docker push --platform linux/amd64,linux/arm64,linux/arm/v7 $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 login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
- 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
|
||||
- docker pull $IMAGE_TAG
|
||||
- docker tag $IMAGE_TAG $CI_REGISTRY_IMAGE:latest
|
||||
- docker push $CI_REGISTRY_IMAGE:latest
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue