forked from VILLASframework/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
68 lines (59 loc) · 1.67 KB
/
.gitlab-ci.yml
File metadata and controls
68 lines (59 loc) · 1.67 KB
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
66
67
68
variables:
GIT_SUBMODULE_STRATEGY: recursive
DOCKER_IMAGE: registry.git.rwth-aachen.de/acs/public/villas/documentation
DOCKER_TAG: ${CI_COMMIT_REF_NAME}
stages:
- prepare
- build
- deploy
# Stage: prepare
prepare:image-dev:
stage: prepare
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
script:
- docker build --target dev --tag ${DOCKER_IMAGE}:dev --tag ${DOCKER_IMAGE}:${DOCKER_TAG}-dev .
tags:
- docker-image-builder
# Stage: build
build:image:
stage: build
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
script:
- docker build --tag ${DOCKER_IMAGE}:${DOCKER_TAG} .
- docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
tags:
- docker-image-builder
build:image-latest:
stage: build
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
script:
- docker build --tag ${DOCKER_IMAGE}:latest .
- docker push ${DOCKER_IMAGE}:latest
only:
- master
tags:
- docker-image-builder
# Stage: deploy
deploy:kubernetes:
stage: deploy
variables:
KUBECONFIG: /root/.kube/config
image: debian:bookworm
before_script:
- >
DEBIAN_FRONTEND=noninteractive
apt-get update &&
apt install -y git make ca-certificates wget
- wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
- chmod +x /usr/local/bin/kubectl
- mkdir -p $(dirname ${KUBECONFIG})
- echo "${KUBECONFIG_ENCODED}" | base64 -d > ${KUBECONFIG}
- kubectl version
script:
- make deploy
only:
refs:
- master