32 lines
715 B
YAML
32 lines
715 B
YAML
|
image: docker:latest
|
||
|
services:
|
||
|
- docker:dind
|
||
|
|
||
|
stages:
|
||
|
- release
|
||
|
- deploy
|
||
|
|
||
|
variables:
|
||
|
DOCKER_HOST: tcp://docker:2376
|
||
|
DOCKER_TLS_CERTDIR: "/certs"
|
||
|
CONTAINER_BRANCH_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
||
|
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
|
||
|
|
||
|
release:
|
||
|
stage: release
|
||
|
script:
|
||
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||
|
- docker build . -t $CONTAINER_BRANCH_IMAGE
|
||
|
- docker push $CONTAINER_BRANCH_IMAGE
|
||
|
|
||
|
release-master:
|
||
|
stage: release
|
||
|
script:
|
||
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||
|
- docker build . -t $CONTAINER_RELEASE_IMAGE
|
||
|
- docker push $CONTAINER_RELEASE_IMAGE
|
||
|
only:
|
||
|
- master
|
||
|
|
||
|
|