-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
121 lines (111 loc) · 3.06 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
stages:
- databases_build
- api_build
- app_build
variables:
IMAGE_POSTGRES: ${CI_REGISTRY_USER}/${CI_REGISTRY_NAMESPACE}:postgres
IMAGE_REDIS: ${CI_REGISTRY_USER}/${CI_REGISTRY_NAMESPACE}:redis
IMAGE_FASTAPI_DEV: ${CI_REGISTRY_USER}/${CI_REGISTRY_NAMESPACE}:fastapi_dev
IMAGE_FASTAPI_PRO: ${CI_REGISTRY_USER}/${CI_REGISTRY_NAMESPACE}:fastapi_pro
IMAGE_VUE_DEV: ${CI_REGISTRY_USER}/${CI_REGISTRY_NAMESPACE}:vue_dev
IMAGE_VUE_PRO: ${CI_REGISTRY_USER}/${CI_REGISTRY_NAMESPACE}:vue_pro
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- when: always
postgres_build:
stage: databases_build
image: docker
services:
- docker:dind
tags:
- docker
rules:
- if: $CI_COMMIT_BRANCH == "development"
- if: $CI_COMMIT_BRANCH == "main"
allow_failure: true
script:
- echo ${CI_REGISTRY_TOKEN} | docker login -u ${CI_REGISTRY_USER} --password-stdin
- cd postgres
- docker build -t $IMAGE_POSTGRES --build-arg="POSTGRES_USER=${POSTGRES_USER}"
--build-arg="POSTGRES_DB=${POSTGRES_DB}" --build-arg="POSTGRES_PASSWORD=${POSTGRES_PASSWORD}" .
- docker push $IMAGE_POSTGRES
redis_build:
stage: databases_build
image: docker
services:
- docker:dind
tags:
- docker
rules:
- if: $CI_COMMIT_BRANCH == "development"
- if: $CI_COMMIT_BRANCH == "main"
allow_failure: true
script:
- echo ${CI_REGISTRY_TOKEN} | docker login -u ${CI_REGISTRY_USER} --password-stdin
- cd redis
- docker build -t $IMAGE_REDIS --build-arg="REDIS_PASSWORD=${REDIS_PASSWORD}" .
- docker push $IMAGE_REDIS
# Backend builds
fastapi_dev_build:
stage: api_build
image: docker
services:
- docker:dind
tags:
- docker
rules:
- if: $CI_COMMIT_BRANCH == "development"
allow_failure: true
script:
- echo ${CI_REGISTRY_TOKEN} | docker login -u ${CI_REGISTRY_USER} --password-stdin
- cd api/
- docker build -t $IMAGE_FASTAPI_DEV .
- docker push $IMAGE_FASTAPI_DEV
fastapi_pro_build:
stage: api_build
image: docker
services:
- docker:dind
tags:
- docker
rules:
- if: $CI_COMMIT_BRANCH == "main"
allow_failure: true
script:
- echo ${CI_REGISTRY_TOKEN} | docker login -u ${CI_REGISTRY_USER} --password-stdin
- cd api/
- docker build -t $IMAGE_FASTAPI_PRO .
- docker push $IMAGE_FASTAPI_PRO
# Frontend builds
vue_dev_build:
stage: app_build
image: docker
services:
- docker:dind
tags:
- docker
rules:
- if: $CI_COMMIT_BRANCH == "development"
allow_failure: true
script:
- echo ${CI_REGISTRY_TOKEN} | docker login -u ${CI_REGISTRY_USER} --password-stdin
- cd app/
- docker build -t $IMAGE_VUE_DEV .
- docker push $IMAGE_VUE_DEV
vue_pro_build:
stage: app_build
image: docker
services:
- docker:dind
tags:
- docker
rules:
- if: $CI_COMMIT_BRANCH == "main"
allow_failure: true
script:
- echo ${CI_REGISTRY_TOKEN} | docker login -u ${CI_REGISTRY_USER} --password-stdin
- cd app/
- docker build -t $IMAGE_VUE_PRO .
- docker push $IMAGE_VUE_PRO