forked from martin-helmich/cloudnativego-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
58 lines (53 loc) · 1.44 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
stages:
- build
- dockerbuild
- publish
- deploy
cache:
paths:
- dist
- node_modules
build:frontend:
image: node:6
stage: build
before_script:
- npm install -g typescript webpack
- npm install
script:
- webpack
dockerbuild:frontend:
image: docker:17.04.0-ce
stage: dockerbuild
dependencies:
- build:frontend
script:
- docker image build -t myevents/frontend:$CI_COMMIT_REF_NAME .
only:
- tags
publish:
image: docker:17.04.0-ce
stage: publish
dependencies:
- dockerbuild:frontend
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
script:
- docker image push myevents/frontend:$CI_COMMIT_REF_NAME
only:
- tags
deploy:
image: alpine:3.5
stage: deploy
environment: production
before_script:
- apk add --update openssl
- wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.6.1/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
- echo "$KUBE_CA_CERT" > ca.crt
- kubectl config set-credentials gitlab-ci --token="${KUBE_TOKEN}"
- kubectl config set-cluster your-cluster --server=https://your-cluster.example --certificate-authority=ca.crt
- kubectl config set-context your-cluster --cluster=your-cluster --user=gitlab-ci
- kubectl config use-context your-cluster
script:
- kubectl set image deployment/eventservice api=myevents/frontend:${CI_COMMIT_REF_NAME}
only:
- tags