-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
47 lines (43 loc) · 1.24 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
stages:
- build
- run-on-prod
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
build-job:
stage: build
tags:
- builder
before_script:
- docker login -u seal_registry -p $CI_REGISTRY_TOKEN $CI_REGISTRY
script:
- >
DOCKER_BUILDKIT=1
docker build
--build-arg access_token=$READ_SEALS_PROJECTS
-t $IMAGE_TAG
--add-host gitlab.kvant.online:192.168.158.67
.
- docker push $IMAGE_TAG
after_script:
- docker logout ${CI_REGISTRY}
rules:
- if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "test"
exists:
- Dockerfile
run-on-prod-job: # Запуск в проде
stage: run-on-prod
tags:
- seal-app-prod
before_script:
- docker login -u $READ_ALL_REGISTRY_USER -p $READ_ALL_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker-compose -f docker-compose.prod.yml pull
- docker-compose -f docker-compose.prod.yml up -d
- docker rmi $(docker images -f dangling=true -q) -f || true
after_script:
- docker logout ${CI_REGISTRY}
#when: manual
#allow_failure: false # блокируем конвейер
# Запускается только в том случае, если ветка master
rules:
- if: $CI_COMMIT_BRANCH == "master"