-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
66 lines (60 loc) · 1.5 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
image: docker:19.03.13
stages:
- build
- deploy
variables:
CLIENT_IMAGE_NAME: $CI_REGISTRY/scpomedialab/trajectories-of-engagement-client:$CI_COMMIT_REF_SLUG
API_IMAGE_NAME: $CI_REGISTRY/scpomedialab/trajectories-of-engagement-api:$CI_COMMIT_REF_SLUG
build_client:
stage: build
script:
- docker build -t $CLIENT_IMAGE_NAME -f ./client/Dockerfile ./client
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
- docker push $CLIENT_IMAGE_NAME
environment:
name: $CI_COMMIT_REF_SLUG
tags:
- proxy
only:
- main
- staging
- prod
- tags
build_api:
stage: build
script:
- docker build -t $API_IMAGE_NAME -f Dockerfile .
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
- docker push $API_IMAGE_NAME
environment:
name: $CI_COMMIT_REF_SLUG
tags:
- proxy
only:
- main
- staging
- prod
- tags
deploy:
image:
name: jrisp/kubehelper:latest
entrypoint: [""]
stage: deploy
before_script:
- export KUBECONFIG=$kubeconfig_file
dependencies:
- build_client
- build_api
script:
- NS=trajectories-of-engagement
- kubectl apply -f k8s/namespace.yml
- cp ${MONGODB_SECRETS} k8s/overlays/$CI_COMMIT_REF_SLUG/mongodb.env
- kubectl apply -k k8s/overlays/$CI_COMMIT_REF_SLUG
- kubectl -n ${NS} rollout restart deployment ${NS}-api
- kubectl -n ${NS} rollout restart deployment ${NS}-client
environment:
name: $CI_COMMIT_REF_SLUG
tags:
- proxy
only:
- prod