battleship-back/.gitlab-ci.yml
Administrator c34175b262 fix
2022-09-12 11:59:48 +03:00

54 lines
1.1 KiB
YAML

stages:
- build
- test
- deploy-dev
- deploy-prod
build:
stage: build
tags:
- dev
before_script:
- docker login -u mathwave -p $DOCKERHUB_PASSWORD
script:
- docker build -t mathwave/sprint-repo:battleship-back .
- docker push mathwave/sprint-repo:battleship-back
- docker build -t mathwave/sprint-repo:battleship-nginx nginx
- docker push mathwave/sprint-repo:battleship-nginx
test:
stage: test
tags:
- dev
script:
- docker run --rm mathwave/sprint-repo:battleship-back pytest tests
.deploy:
before_script:
- docker login -u mathwave -p $DOCKERHUB_PASSWORD
- docker network create -d overlay --attachable battleship-nginx || true
deploy-dev:
extends:
- .deploy
stage: deploy-dev
tags:
- dev
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: on_success
- when: manual
script:
- docker stack deploy -c ./.deploy/deploy-dev.yaml battleship
deploy-prod:
extends:
- .deploy
stage: deploy-prod
tags:
- prod
only:
- master
when: manual
script:
- docker stack deploy -c ./.deploy/deploy-prod.yaml battleship