-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
54 lines (49 loc) · 1.5 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
stages:
- test
- docker
- deploy
variables:
KUBECONFIG: .kube/config
cache: &global_cache
key: $CI_PROJECT_NAME
paths:
- node_modules/
- public/
policy: pull-push
build:
retry: 2
script:
- yarn install --frozen-lockfile --check-files --cache-folder .yarn --prefer-offline
- sed -i 's_localhost_https://100daysofhomelab.com_' config.toml
- yarn build
image: node:18.13.0
stage: test
cache:
<<: *global_cache
docker_image_build_release:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: docker
cache:
<<: *global_cache
policy: pull
retry: 2
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --destination $CI_REGISTRY_IMAGE:latest
deploy:
image:
name: bitnami/kubectl@sha256:6b383654dba84f68c9603bec1fc891910ab8f4ee3f8b20b0e9492d1e3a2ec459 #1.27.14
entrypoint: [""]
cache: []
stage: deploy
retry: 2
before_script:
- sed -ie "s/deploy-date-value/$(date)/g" kubernetes/deployment.yaml
- sed -ie "s|registry-value|$CI_REGISTRY_IMAGE|g" kubernetes/deployment.yaml
- mkdir -p .kube/ && touch .kube/config
- echo ${KUBERNETES_PUBLIC_CLUSTER} | base64 -d -i > ${KUBECONFIG}
script:
- kubectl apply -f kubernetes/deployment.yaml