-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
52 lines (48 loc) · 1.47 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
cache:
key: constant-key-caches-across-builds-$PROJECT_ID
paths:
- node_modules
- cache
stages:
- compile
- build
- deploy
compile site:
image: node:10
stage: compile
script:
- yarn config set cache-folder ./cache/yarn
- npm install
- npm run build
artifacts:
expire_in: 1 week
paths:
- public
build:
stage: build
retry: 2
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
services:
- docker:dind
variables:
DOCKER_HOST: tcp://localhost:2375
only:
- tags
- master
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
deploy_prod:
stage: deploy
image: registry.netprophet.tech/netp/libs/docker-k8s-util:latest
script:
- export KUBE_URL=https://ctrl.lwb.co:6443
- kubectl config set-cluster "$CI_PROJECT_ID" --server="$KUBE_URL" --certificate-authority="$KUBE_CA_PEM_FILE"
- kubectl config set-credentials "$CI_PROJECT_ID" --token="$KUBE_TOKEN"
- kubectl config set-context "$CI_PROJECT_ID" --cluster="$CI_PROJECT_ID" --user="$CI_PROJECT_ID" --namespace="$KUBE_NAMESPACE"
- kubectl config use-context "$CI_PROJECT_ID"
- bin/k8s.deploy "$CI_COMMIT_SHA"
only:
- master