Revize 053244c6
Přidáno uživatelem Michal Schwob před asi 3 roky(ů)
.gitlab-ci.yml | ||
---|---|---|
1 |
# https://docs.gitlab.com/ee/ci/ |
|
2 |
image: alpine:3.12 |
|
3 |
|
|
1 | 4 |
variables: |
2 |
DOCKER_HOST: tcp://docker:2375 |
|
5 |
K8S_VERSION: v1.20.5 |
|
6 |
APP: ${CI_REGISTRY_IMAGE}/app:${CI_COMMIT_SHORT_SHA} |
|
7 |
KUSTOMIZE: kustomization/kustomize.yaml |
|
3 | 8 |
|
4 |
build:
|
|
5 |
image: docker:19.03.12
|
|
9 |
# build docker images
|
|
10 |
build application image:
|
|
6 | 11 |
stage: build |
12 |
image: |
|
13 |
name: gcr.io/kaniko-project/executor:debug |
|
14 |
entrypoint: [""] |
|
15 |
# comment this out on production |
|
16 |
when: manual |
|
17 |
script: |
|
18 |
- mkdir -p /kaniko/.docker |
|
19 |
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json |
|
20 |
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile docker/application/Dockerfile --destination $APP --verbosity info |
|
7 | 21 |
|
8 |
|
|
9 |
|
|
10 |
services: |
|
11 |
- docker:19.03.12-dind |
|
22 |
# deploy test to kubernetes |
|
23 |
deploy test: |
|
24 |
stage: deploy |
|
25 |
environment: production |
|
26 |
#only: |
|
27 |
# - /^test/ |
|
28 |
when: manual |
|
12 | 29 |
script: |
13 |
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD gitlab.kiv.zcu.cz:5000 |
|
14 |
- docker build -t $CI_REGISTRY/aswi/aswi-2022/aswi2022code-of-duty:latest ./backend |
|
15 |
- docker push $CI_REGISTRY/aswi/aswi-2022/aswi2022code-of-duty:latest |
|
30 |
- wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$K8S_VERSION/bin/linux/amd64/kubectl |
|
31 |
- chmod +x /usr/local/bin/kubectl |
|
32 |
- kubectl version |
|
33 |
- apk add gettext git |
|
34 |
- kubectl kustomize kustomization/ | envsubst | tee $KUSTOMIZE |
|
35 |
- kubectl apply -f $KUSTOMIZE |
|
36 |
|
Také k dispozici: Unified diff
Update .gitlab-ci.yml file