-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
135 lines (112 loc) · 2.91 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
image: docker:latest
services:
- docker:dind
#
#only:
# - some_branch_name
#
# ===> whether you push to master or to that branch , the pipelines will be triggered for that branch you chose.
# next : how to make it get triggered when code was pushed to only that specific branch ?
stages:
- build
- package
- deploy
build-frontend:
stage: build
image: trion/ng-cli-karma:7.3.0
script:
- cd frontEnd
- npm ci
- npm run build
artifacts:
paths:
- frontEnd/dist/
expire_in: 1 week
tags:
- linux
- docker
only:
- master
build-backend:
stage: build
image: node:10
script:
- cd backEnd/gitlab-stats-api/
- npm i @nestjs/cli
- npm run build
artifacts:
paths:
- backEnd/gitlab-stats-api/dist/
expire_in: 1 week
tags:
- linux
- docker
only:
- master
package-frontend:
stage: package
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- pwd
- ls -la
- docker build -t registry.gitlab.com/w11k-devs/intern/gitlab-stats/client:latest -f frontEnd/Dockerfile .
- docker push registry.gitlab.com/w11k-devs/intern/gitlab-stats/client:latest
tags:
- linux
- docker
only:
- master
package-backend:
stage: package
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker build -t registry.gitlab.com/w11k-devs/intern/gitlab-stats/backend:latest -f backEnd/gitlab-stats-api/Dockerfile .
- docker push registry.gitlab.com/w11k-devs/intern/gitlab-stats/backend:latest
tags:
- linux
- docker
only:
- master
package-docker-db:
stage: package
script:
- docker create -e 'POSTGRES_USER=kalud' -e 'POSTGRES_PASSWORD=xxx' -e 'POSTGRES_DB=kalud-db' --volume postgres-database:/var/lib/postgresql/data -p 15432:5432 --name postgres-db postgres
- docker start postgres-db
- sleep 20
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker commit postgres-db registry.gitlab.com/w11k-devs/intern/gitlab-stats/db
- docker push registry.gitlab.com/w11k-devs/intern/gitlab-stats/db
tags:
- linux
- docker
only:
- master
#deploy-docker-titanic:
# stage: deploy
# script:
# - ssh gitlab@titanic "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com"
# - ssh gitlab@titanic "cd git/gitlab-stats && docker-compose stop && docker-compose pull && docker-compose up -d"
# tags:
# - linux
# - shell
# #when: manual
# only:
# - master
deploy-frontend:
stage: deploy
script:
- curl -X POST https://portainer.w11k-dev.de/api/webhooks/625c71ab-5ea4-46b1-84b9-a6acf73e170a
tags:
- linux
- shell
only:
- master
deploy-backend:
stage: deploy
script:
- curl -X POST https://portainer.w11k-dev.de/api/webhooks/068534f1-32aa-4cb3-b028-511fbbbf9cbc
tags:
- linux
- shell
only:
- master