-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
56 lines (42 loc) · 1.45 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
image: docker:latest
services:
- docker:dind
stages:
- build
- deploy
before_script:
- apk --update add git
- git submodule update --init
variables:
DOCKER_DRIVER: overlay2
build:
stage: build
only:
- master
script:
- echo PORT=$PORT >> .env
- echo MYSQL_HOST=$MYSQL_HOST >> .env
- echo MYSQL_USER=$MYSQL_USER >> .env
- echo MYSQL_PASSWORD=$MYSQL_PASSWORD >> .env
- echo MYSQL_DATABASE=$MYSQL_DATABASE >> .env
- echo TOKEN=$TOKEN >> .env
- echo OWNER_ID=$OWNER_ID >> .env
- echo HELPBOT_COMMAND_PREFIX=$HELPBOT_COMMAND_PREFIX >> .env
- echo HELPBOT_ADMIN_ROLE_NAME=$HELPBOT_ADMIN_ROLE_NAME >> .env
- echo HELPBOT_QUESTIONS_CHANNEL_ID=$HELPBOT_QUESTIONS_CHANNEL_ID >> .env
- docker build --build-arg NPM_TOKEN="$NPM_TOKEN" -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" .
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA"
deploy-master:
stage: deploy
image: mateothegreat/docker-alpine-gcloud-kubectl
only:
- master
script:
- kubectl config set-cluster kube-cluster --server="$K8_API_URL" --insecure-skip-tls-verify=true
- kubectl config set-credentials gitlab --token="$K8_TOKEN"
- kubectl config set-context default-context --cluster=kube-cluster --user=gitlab
- kubectl config use-context default-context
- apk --update add git
- git submodule update --init
- make delete install