-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
56 lines (51 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
48
49
50
51
52
53
54
55
56
stages:
- build
- deploy
- cleanup
docker-build-dev:
rules:
- if: $CI_BUILD_REF_NAME == "dev"
when: on_success
- when: never
stage: build
interruptible: true
script:
- docker build . -t $CI_PROJECT_NAME-dev:latest --build-arg NEXT_PUBLIC_BACK_URL=https://api.metrica-agency.ru
docker-build-prod:
rules:
- if: $CI_BUILD_REF_NAME == "master"
when: on_success
- when: never
stage: build
interruptible: true
script:
- docker build . -t $CI_PROJECT_NAME-prod:latest --build-arg NEXT_PUBLIC_BACK_URL=https://api.metrica-agency.ru
restart-dev:
rules:
- if: $CI_BUILD_REF_NAME == "dev"
when: on_success
- when: never
stage: deploy
interruptible: true
script:
- cd ~/$CI_PROJECT_NAME-dev/
- docker-compose up -d
restart-prod:
rules:
- if: $CI_BUILD_REF_NAME == "master"
when: on_success
- when: never
stage: deploy
interruptible: true
script:
- cd ~/$CI_PROJECT_NAME-prod/
- docker-compose up -d
cleanup:
rules:
- if: $CI_BUILD_REF_NAME == "master" || $CI_BUILD_REF_NAME == "dev"
when: on_success
- when: never
interruptible: true
stage: cleanup
script:
- docker rmi --force $(docker images -q --filter "dangling=true") || echo test