Retain tagged versions of crafty images

This commit is contained in:
Zedifus 2022-10-08 19:29:34 +01:00
parent 5c40ce5195
commit 77d9a8d26d

View File

@ -87,22 +87,23 @@ docker-build-prod:
- echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
script: script:
- | - |
tag=""
VERSION="${MAJOR}.${MINOR}.${SUB}-${META}" VERSION="${MAJOR}.${MINOR}.${SUB}-${META}"
- | - |
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" echo "Running on branch '$CI_COMMIT_BRANCH'"
echo "Crafty Version: $VERSION" echo "Crafty Version: $VERSION"
- docker context create tls-environment - docker context create tls-environment
- docker buildx create --name zedBuilder --use tls-environment - docker buildx create --name zedBuilder --use tls-environment
- docker buildx build - docker buildx build
--cache-from type=registry,ref="$CI_REGISTRY_IMAGE${tag}" --cache-from type=registry,ref="$CI_REGISTRY_IMAGE"
--build-arg BUILDKIT_INLINE_CACHE=1 --build-arg BUILDKIT_INLINE_CACHE=1
--build-arg "BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ")" --build-arg "BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ")"
--build-arg "BUILD_REF=${CI_COMMIT_SHA}" --build-arg "BUILD_REF=${CI_COMMIT_SHA}"
--build-arg "CRAFTY_VER=${VERSION}" --build-arg "CRAFTY_VER=${VERSION}"
--tag "$CI_REGISTRY_IMAGE${tag}" --tag "crafty-build"
--platform linux/arm64/v8,linux/amd64 --platform linux/arm64/v8,linux/amd64 .
--push . - docker image tag "crafty-build" "$CI_REGISTRY_IMAGE"
- docker image tag "crafty-build" "$CI_REGISTRY_IMAGE:${VERSION}"
- docker image push -a
after_script: after_script:
- | - |
docker buildx rm zedBuilder && echo "Successfully Stopped builder instance" || echo "Failed to stop builder instance." docker buildx rm zedBuilder && echo "Successfully Stopped builder instance" || echo "Failed to stop builder instance."