-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
52 lines (48 loc) · 1.05 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
stages:
- build
- test
- deploy
variables:
REGISTRY_SERVER: dk8s-registry.wr.usgs.gov
IMAGE_TAG: $REGISTRY_SERVER/croplands-web:latest
build:
stage: build
image: docker:18
services:
- name: usgsastro/dind
alias: docker
tags:
- dind
- dmz
script:
- docker login -u $DK8S_REGISTRY_USER -p $DK8S_REGISTRY_PWD $REGISTRY_SERVER
- docker build --pull -t $IMAGE_TAG .
- docker push $IMAGE_TAG
only:
changes:
- Dockerfile
- requirements.txt
- croplands-web/**
test:
image: usgsastro/kube
stage: test
tags:
- dmz
script:
- mkdir ~/.kube
- echo "$DK8S_CONFIG" > ~/.kube/config
- kubectl config set-context --current --namespace croplands
- kubectl apply --dry-run=client -f k8s/
deploy:
image: usgsastro/kube
stage: deploy
tags:
- dmz
script:
- mkdir ~/.kube
- echo "$DK8S_CONFIG" > ~/.kube/config
- kubectl config set-context --current --namespace croplands
- kubectl apply -f k8s/
- kubectl delete po -l app=croplands-web
only:
- master