-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
50 lines (47 loc) · 1.34 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
stages:
- build
- deploy
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/$CI_PROJECT_PATH
DOCKER_REGISTRY: registry.digitalocean.com
IMAGE_NAME: 'everclub/front'
APP_NAME: 'front'
HELM_CHART: 'front'
KUB_NAMESPACE: 'everclub-bsc'
TAG_COMMIT: $CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA
build:
stage: build
tags:
- deploy
before_script:
- pwd
- echo $CI_COMMIT_REF_NAME
- doctl auth init
- doctl registry login
script:
- docker build --build-arg API_URL=$ENV_API_URL --build-arg CHAIN_ID=$BLOCKCHAIN_ID -t $DOCKER_REGISTRY/$IMAGE_NAME:$TAG_COMMIT .
- docker push $DOCKER_REGISTRY/$IMAGE_NAME:$TAG_COMMIT
- docker rmi --force $DOCKER_REGISTRY/$IMAGE_NAME:$TAG_COMMIT
- docker rmi $(docker images -f "dangling=true" -q) --force
environment:
name: $CI_COMMIT_REF_NAME
only:
- develop
- main
deploy:
stage: deploy
tags:
- deploy
before_script:
- doctl kubernetes cluster kubeconfig save $KUBERNETES_CLUSTER
script:
- helm upgrade --install --wait --atomic --debug --timeout 300s
$APP_NAME ./helm/$HELM_CHART -n $KUB_NAMESPACE
--values ./helm/env/$FILENAME_ENV.yaml
--set image.tag=$TAG_COMMIT --set image.repository=$IMAGE_NAME
- doctl auth remove --context default
environment:
name: $CI_COMMIT_REF_NAME
only:
- develop
- main