1
mirror of https://gitlab.com/jessieh/simple-shortener.git synced 2024-11-09 22:41:46 +00:00
simple-shortener/.gitlab-ci.yml

33 lines
702 B
YAML
Raw Normal View History

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:
- 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}