-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.example.yml
69 lines (64 loc) · 1.32 KB
/
.gitlab-ci.example.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
57
58
59
60
61
62
63
64
65
66
67
68
69
image: docker:latest
stages:
- build
- deploy-dev
- deploy-prod
- cleanup
build:
stage: build
script:
- if [ "$(docker ps -a | grep felix_$CI_COMMIT_REF_NAME)" ]; then
- docker stop felix_$CI_COMMIT_REF_NAME && docker rm felix_$CI_COMMIT_REF_NAME
- fi
- if [ "$(docker images | grep notification_api:$CI_COMMIT_REF_NAME)" ]; then
- docker rmi notification_api:$CI_COMMIT_REF_NAME
- fi
- docker build -t notification_api:$CI_COMMIT_REF_NAME .
only:
- master
- dev
tags:
- soc-group
deploy-dev:
stage: deploy-dev
script:
- docker run
-p 8007:8009
-d
--name=felix_$CI_COMMIT_REF_NAME
--restart=always
-m 150M
--memory-swap=200M
-e MYSQL_DB=$MYSQL_DB_DEV
notification_api:$CI_COMMIT_REF_NAME
only:
- dev
tags:
- soc-group
deploy-prod:
stage: deploy-prod
script:
- docker run
-p 8006:8009
-d
--name=felix_$CI_COMMIT_REF_NAME
--restart=always
-m 250M
--memory-swap=300M
-e MYSQL_DB=$MYSQL_DB_PROD
notification_api:$CI_COMMIT_REF_NAME
only:
- master
tags:
- soc-group
cleanup:
stage: cleanup
script:
- echo y | docker container prune -f
- echo y | docker image prune -f
when: on_success
only:
- dev
- master
tags:
- soc-group