mirror of
https://gitlab.com/jessieh/simple-shortener.git
synced 2024-11-12 23:51:46 +00:00
33 lines
702 B
YAML
33 lines
702 B
YAML
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:
|
|
- docker build --tag=${CI_REGISTRY_IMAGE}:latest .
|
|
- 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}
|