forked from ans-group/docs.ukfast.co.uk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
50 lines (45 loc) · 1.26 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:
IMAGE_NAME: ${CI_REGISTRY_IMAGE}/app:${CI_COMMIT_SHA}
POPULATOR_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/populator:${CI_COMMIT_SHA}
.docker_build:
stage: build
image: docker:19.03.1
services:
- docker:19.03.1-dind
only:
- master
tags:
- dind
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
build_app:
extends: .docker_build
script:
- docker build -t $IMAGE_NAME -f Dockerfile .
- docker push $IMAGE_NAME
build_populator:
extends: .docker_build
script:
- docker build -t $POPULATOR_IMAGE_NAME -f populator/Dockerfile .
- docker push $POPULATOR_IMAGE_NAME
deploy_production:
stage: deploy
image: $KUSTOMIZE_IMAGE
only:
- master
tags:
- docker
script:
- cd .ci/kustomize
- kustomize create --resources base
- kustomize edit set image appImage=${IMAGE_NAME}
- kustomize edit set image populatorImage=${POPULATOR_IMAGE_NAME}
- kustomize edit set namespace $NAMESPACE_NAME
- kustomize build . | kubectl apply -f -
- kustomize build . | kubectl apply --dry-run -f - | grep deployment | awk '{print $1}' | xargs -n1 kubectl -n ${NAMESPACE_NAME} rollout status -w
environment:
name: prod
url: docs.ukfast.co.uk