2021-12-21 03:50:17 +00:00
|
|
|
image: docker:20
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- tag
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
|
|
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
only:
|
|
|
|
- main
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
script:
|
2021-12-21 03:56:30 +00:00
|
|
|
- docker build --tag=${CI_REGISTRY_IMAGE}:latest .
|
2021-12-21 03:50:17 +00:00
|
|
|
- docker push ${CI_REGISTRY_IMAGE}:latest
|
|
|
|
|
|
|
|
tag:
|
|
|
|
stage: tag
|
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
variables:
|
|
|
|
# Don't clone the project source-- we're just tagging a docker image:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
script:
|
|
|
|
- docker pull ${CI_REGISTRY_IMAGE}:latest
|
|
|
|
- docker tag ${CI_REGISTRY_IMAGE}:latest ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}
|
|
|
|
- docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}
|