-
Notifications
You must be signed in to change notification settings - Fork 61
/
.gitlab-ci.yml
71 lines (64 loc) · 1.92 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
image: docker:stable
stages:
- build
- deploy
variables:
BACKEND_IMAGE_NAME: $CI_REGISTRY/scpomedialab/hyphe_backend
CRAWLER_IMAGE_NAME: $CI_REGISTRY/scpomedialab/hyphe_crawler
FRONTEND_IMAGE_NAME: $CI_REGISTRY/scpomedialab/hyphe_frontend
before_script:
- VERSION=$(echo $CI_COMMIT_TAG | sed -nre 's/^v([0-9.]+)$/\1/p')
- if [ -n "${VERSION}" ]; then IMAGE_TAG=${VERSION}; else IMAGE_TAG=${CI_COMMIT_REF_SLUG}; fi
- echo "$IMAGE_TAG" > config/VERSION
- echo "$IMAGE_TAG" > hyphe_frontend/app/conf/VERSION
- export KUBECONFIG=$kubeconfig_file
build_backend_image:
stage: build
script:
- docker build -t $BACKEND_IMAGE_NAME:$IMAGE_TAG -f Dockerfile .
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
- docker push $BACKEND_IMAGE_NAME:$IMAGE_TAG
environment:
name: $CI_COMMIT_REF_SLUG
only:
- staging
- prod
- tags
build_crawler_image:
stage: build
script:
- docker build -t $CRAWLER_IMAGE_NAME:$IMAGE_TAG -f ./hyphe_backend/crawler/Dockerfile ./hyphe_backend/crawler/
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
- docker push $CRAWLER_IMAGE_NAME:$IMAGE_TAG
environment:
name: $CI_COMMIT_REF_SLUG
only:
- staging
- prod
- tags
build_frontend_image:
stage: build
script:
- docker build -t $FRONTEND_IMAGE_NAME:$IMAGE_TAG -f ./hyphe_frontend/Dockerfile ./hyphe_frontend/
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
- docker push $FRONTEND_IMAGE_NAME:$IMAGE_TAG
environment:
name: $CI_COMMIT_REF_SLUG
only:
- staging
- prod
- tags
deploy:
image:
name: jrisp/kubehelper:latest
entrypoint: [""]
stage: deploy
script:
- kubectl -n $STACK rollout restart deployment backend
- kubectl -n $STACK rollout restart deployment crawler
- kubectl -n $STACK rollout restart deployment frontend
environment:
name: $CI_COMMIT_REF_SLUG
only:
- staging
- prod