1 |
7f244939
|
Lukáš Vlček
|
image: gcr.io/kaniko-project/executor:debug
|
2 |
|
|
|
3 |
|
|
stages:
|
4 |
|
|
- Build
|
5 |
|
|
- Deploy
|
6 |
|
|
|
7 |
|
|
build-fe:
|
8 |
|
|
stage: Build
|
9 |
|
|
rules:
|
10 |
|
|
- if: '$CI_COMMIT_BRANCH == "main"'
|
11 |
|
|
when: on_success
|
12 |
|
|
- if: "$CI_COMMIT_BRANCH == null"
|
13 |
|
|
when: never
|
14 |
|
|
- when: manual
|
15 |
|
|
script:
|
16 |
|
|
- mkdir -p /kaniko/.docker
|
17 |
|
|
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
18 |
|
|
- /kaniko/executor --cache=true --context "$CI_PROJECT_DIR/webapp" --dockerfile "$CI_PROJECT_DIR/webapp/Dockerfile" --destination $CI_REGISTRY_IMAGE/frontend:$CI_COMMIT_SHA
|
19 |
|
|
|
20 |
|
|
build-be:
|
21 |
|
|
stage: Build
|
22 |
|
|
rules:
|
23 |
|
|
- if: '$CI_COMMIT_BRANCH == "main"'
|
24 |
|
|
when: on_success
|
25 |
|
|
- if: "$CI_COMMIT_BRANCH == null"
|
26 |
|
|
when: never
|
27 |
|
|
- when: manual
|
28 |
|
|
script:
|
29 |
|
|
- mkdir -p /kaniko/.docker
|
30 |
|
|
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
31 |
|
|
- /kaniko/executor --cache=true --context "$CI_PROJECT_DIR/Backend" --dockerfile "$CI_PROJECT_DIR/Backend/Backend/Dockerfile" --destination $CI_REGISTRY_IMAGE/backend:$CI_COMMIT_SHA
|
32 |
|
|
|
33 |
|
|
deploy_webapp_production:
|
34 |
|
|
stage: Deploy
|
35 |
|
|
image:
|
36 |
|
|
name: bitnami/kubectl:latest
|
37 |
|
|
environment:
|
38 |
|
|
name: webapp_production
|
39 |
|
|
url: https://annotation.vlc3k.com
|
40 |
|
|
rules:
|
41 |
|
|
- if: '$CI_COMMIT_BRANCH == "main"'
|
42 |
|
|
when: on_success
|
43 |
|
|
- if: "$CI_COMMIT_BRANCH == null"
|
44 |
|
|
when: never
|
45 |
|
|
- when: manual
|
46 |
|
|
script:
|
47 |
|
|
- kubectl --token=${KUBE_TOKEN} --server=${KUBE_SERVER} set image deployment/nio-annotation nio-annotation-frontend=$CI_REGISTRY_IMAGE/frontend:$CI_COMMIT_SHA --namespace=$KUBE_NAMESPACE --record --insecure-skip-tls-verify=true
|
48 |
|
|
- kubectl --token=${KUBE_TOKEN} --server=${KUBE_SERVER} set image deployment/nio-annotation nio-annotation-backend=$CI_REGISTRY_IMAGE/backend:$CI_COMMIT_SHA --namespace=$KUBE_NAMESPACE --record --insecure-skip-tls-verify=true
|
49 |
|
|
- kubectl --token=${KUBE_TOKEN} --server=${KUBE_SERVER} --namespace=$KUBE_NAMESPACE --insecure-skip-tls-verify=true rollout status deployment nio-annotation
|