75 lines
1.4 KiB
YAML
75 lines
1.4 KiB
YAML
image: tiangolo/docker-with-compose
|
|
|
|
before_script:
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
- pip install docker-auto-labels
|
|
|
|
stages:
|
|
- test
|
|
- build
|
|
- deploy
|
|
|
|
tests:
|
|
stage: test
|
|
script:
|
|
- sh ./scripts/test.sh
|
|
tags:
|
|
- build
|
|
- test
|
|
|
|
build-stag:
|
|
stage: build
|
|
script:
|
|
- TAG=stag FRONTEND_ENV=staging sh ./scripts/build-push.sh
|
|
only:
|
|
- master
|
|
tags:
|
|
- build
|
|
- test
|
|
|
|
build-prod:
|
|
stage: build
|
|
script:
|
|
- TAG=prod FRONTEND_ENV=production sh ./scripts/build-push.sh
|
|
only:
|
|
- production
|
|
tags:
|
|
- build
|
|
- test
|
|
|
|
deploy-stag:
|
|
stage: deploy
|
|
script:
|
|
- >
|
|
DOMAIN={{cookiecutter.domain_staging}}
|
|
TRAEFIK_TAG={{cookiecutter.traefik_constraint_tag_staging}}
|
|
STACK_NAME={{cookiecutter.docker_swarm_stack_name_staging}}
|
|
TAG=stag
|
|
sh ./scripts/deploy.sh
|
|
environment:
|
|
name: staging
|
|
url: https://{{cookiecutter.domain_staging}}
|
|
only:
|
|
- master
|
|
tags:
|
|
- swarm
|
|
- stag
|
|
|
|
deploy-prod:
|
|
stage: deploy
|
|
script:
|
|
- >
|
|
DOMAIN={{cookiecutter.domain_main}}
|
|
TRAEFIK_TAG={{cookiecutter.traefik_constraint_tag}}
|
|
STACK_NAME={{cookiecutter.docker_swarm_stack_name_main}}
|
|
TAG=prod
|
|
sh ./scripts/deploy.sh
|
|
environment:
|
|
name: production
|
|
url: https://{{cookiecutter.domain_main}}
|
|
only:
|
|
- production
|
|
tags:
|
|
- swarm
|
|
- prod
|