-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
65 lines (56 loc) · 1.87 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
59
60
61
62
63
64
65
# Build und Deployment Pipeline
# Do not change until you know what you are doing !!!
image: "thlmylab/swakkd:stable"
variables:
DOMAIN: ""
INGRESS: "True"
stages:
- prepare
- build
- deploy
registry-cred:
stage: prepare
script:
- kubectl delete secret gitlab-registry-$CI_PROJECT_ID || true
- "kubectl create secret docker-registry gitlab-registry-$CI_PROJECT_ID \
--docker-server=$CI_REGISTRY \
--docker-username=image-registry \
--docker-password=$CI_REGISTRY_TOKEN"
frontend-build:
stage: build
image: docker:dind
services: ["docker:dind"]
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE/frontend-$CI_COMMIT_REF_NAME:latest ./frontend
- docker push $CI_REGISTRY_IMAGE/frontend-$CI_COMMIT_REF_NAME:latest
backend-build:
stage: build
image: docker:dind
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE/backend-$CI_COMMIT_REF_NAME:latest ./backend
- docker push $CI_REGISTRY_IMAGE/backend-$CI_COMMIT_REF_NAME:latest
frontend-deploy:
stage: deploy
script:
- mo deploy/frontend/deployment.yaml | kubectl delete -f - || true
- mo deploy/frontend/deployment.yaml | kubectl apply -f -
- mo deploy/frontend/service.yaml | kubectl apply -f -
backend-deploy:
stage: deploy
script:
- mo deploy/backend/deployment.yaml | kubectl delete -f - || true
- mo deploy/backend/service.yaml | kubectl apply -f -
- mo deploy/backend/volume.yaml | kubectl apply -f -
- mo deploy/backend/database.yaml | kubectl apply -f -
- mo deploy/backend/deployment.yaml | kubectl apply -f -
ingress:
stage: deploy
only:
variables:
- $INGRESS == "True"
script:
- HOST=asteroids.$DOMAIN mo deploy/webapp-ing.yaml | kubectl apply -f -