code-snippets/docker/astra/.gitlab-ci.yml

42 lines
836 B
YAML
Raw Normal View History

2024-04-08 18:35:01 -04:00
stages:
- build_image
- tests
variables:
VERSION: "v1"
build_image:
stage: build_image
tags:
- docker
- dind
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:$VERSION .
- docker tag $CI_REGISTRY_IMAGE:$VERSION $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:$VERSION
- docker push $CI_REGISTRY_IMAGE:latest
- docker rmi $CI_REGISTRY_IMAGE:$VERSION
- docker rmi $CI_REGISTRY_IMAGE:latest
only:
- master
when: manual
allow_failure: false
tests_image:
stage: tests
image: $CI_REGISTRY_IMAGE:latest
needs: ["build_image"]
tags:
- docker
- dind
script:
- git --version
only:
- master