forked from Akkarine/demo_cicd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
54 lines (48 loc) · 1.77 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
48
49
50
51
52
53
54
stages:
- update-runners
- deploy
- update-sertificates
variables:
DOCKER_DRIVER: overlay2
DOCKER_BUILDKIT: 1
update-letsencrypt-dns:
image: tmaier/docker-compose:latest
stage: deploy
script:
# gitlab-runner хранит текущую git-версию файлов в своей папке работающего раннера джобы
- cp -r $CI_PROJECT_DIR/production/letsencrypt-dns/domains.conf /srv/letsencrypt-dns/domains.conf
- docker-compose -f docker-compose.prod.yml pull letsencrypt-dns
- docker-compose -f docker-compose.prod.yml up -d letsencrypt-dns
when: manual
tags:
- production
update-traefik:
image: tmaier/docker-compose:latest
stage: deploy
script:
- cp -r $CI_PROJECT_DIR/production/traefik/dynamic-conf.yml /srv/traefik/dynamic-conf.yml
- cp -r $CI_PROJECT_DIR/production/traefik/traefik.yml /srv/traefik/traefik.yml
- docker-compose -f docker-compose.prod.yml -p prod pull traefik
- docker-compose -f docker-compose.prod.yml -p prod up -d traefik
when: manual
tags:
- production
# Интересно, даст ли сам себя обновить, хотя команды раннер выполняет из другого контейнера.
.update-runners: &update-runners
image: tmaier/docker-compose:latest
stage: update-runners
when: manual
update-production-runner:
<<: *update-runners
script:
- docker-compose -f docker-compose.prod.yml pull gitlab-runner
- docker-compose -f docker-compose.prod.yml -p prod up -d gitlab-runner
tags:
- production
update-staging-runner:
<<: *update-runners
script:
- docker-compose -f docker-compose.staging.yml pull gitlab-runner
- docker-compose -f docker-compose.staging.yml -p staging up -d gitlab-runner
tags:
- staging