-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
48 lines (45 loc) · 1.34 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
stages:
- build
- docker
- deploy
variables:
KUBECONFIG: .kube/config
prod_build:
image: node:v18.16.1
stage: build
script:
- NODE_ENV=production
- yarn install --frozen-lockfile --check-files
- yarn test
- yarn build
artifacts:
paths:
- build/
expire_in: 1 week
docker_image_build_release:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: docker
only:
- tags
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
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest
deploy:
image:
name: bitnami/kubectl@sha256:6410882b254fde82200c364b606b0cbb9b0fb802fede69011a33b9d28066b459 #1.25.9
entrypoint: [""]
cache: []
stage: deploy
only:
- tags
retry: 2
before_script:
- sed -ie "s/deploy-date-value/$(date)/g" kubernetes/deployment.yaml
- mkdir -p .kube/ && touch .kube/config
- echo ${KUBERNETES_KUBE_CONFIG} | base64 -d -i > ${KUBECONFIG}
script:
- kubectl apply -f kubernetes/deployment.yaml