Skip to content

Commit 740c002

Browse files
Add gitlab ci
1 parent 843cd59 commit 740c002

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.gitlab-ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
variables:
2+
# variables for docker service to build image during CI
3+
DOCKER_HOST: tcp://docker:2376
4+
DOCKER_TLS_CERTDIR: "/certs"
5+
DOCKER_TLS_VERIFY: 1
6+
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
7+
8+
# service of dind to build image during CI
9+
services:
10+
- docker:19.03.13-dind
11+
12+
13+
build static:
14+
stage: build:static
15+
image: node:16
16+
script:
17+
- npm i
18+
- npm run build
19+
only:
20+
refs:
21+
- dev
22+
- rc
23+
- master
24+
artifacts:
25+
paths:
26+
- build/
27+
28+
build image:
29+
stage: build:image
30+
image: docker:19.03.13
31+
dependencies:
32+
- build static
33+
script:
34+
- docker build -f ci/Dockerfile -t ssl1321ois/timelog_web:${CI_COMMIT_BRANCH}.${CI_COMMIT_SHORT_SHA} .
35+
- docker login -u=${DOCKER_USER} -p=${DOCKER_PASSWORD}
36+
- docker push ssl1321ois/timelog_web:${CI_COMMIT_BRANCH}.${CI_COMMIT_SHORT_SHA}
37+
only:
38+
refs:
39+
- dev
40+
- rc
41+
- master
42+
43+
deploy:
44+
stage: deploy
45+
image: nightlord851108/kustomize
46+
only:
47+
refs:
48+
- master
49+
script:
50+
- cd deployment/overlay/production
51+
- kustomize edit set image ssl1321ois/timelog_web:${CI_COMMIT_BRANCH}.${CI_COMMIT_SHORT_SHA}
52+
- kustomize build . | kubectl apply --server=${CLUSTER_URL} --token=${CLUSTER_TOKEN} --insecure-skip-tls-verify=true --namespace=production -f -
53+
54+
stages:
55+
- build:static
56+
- build:image
57+
- deploy

0 commit comments

Comments
 (0)