-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
73 lines (68 loc) · 1.79 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
stages:
- env
- build
- release
.setup: &setup
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
env:docker:
only:
- tags
stage: env
image:
name: reg.nju.edu.cn/psv/dotoj/kaniko:debug
entrypoint: [""]
<<: *setup
script:
- >-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile.env"
--destination "${CI_REGISTRY_IMAGE}/env:latest"
--build-arg VERSION="${CI_COMMIT_TAG:1}"
build:webapp:
only:
- tags
stage: build
image:
name: reg.nju.edu.cn/psv/dotoj/kaniko:debug
entrypoint: [""]
<<: *setup
script:
- >-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile.webapp"
--destination "${CI_REGISTRY_IMAGE}/webapp:${CI_COMMIT_TAG:1}"
--build-arg VERSION="${CI_COMMIT_TAG:1}"
build:worker:
only:
- tags
stage: build
image:
name: reg.nju.edu.cn/psv/dotoj/kaniko:debug
entrypoint: [""]
<<: *setup
script:
- >-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile.worker"
--destination "${CI_REGISTRY_IMAGE}/worker:${CI_COMMIT_TAG:1}"
--build-arg VERSION="${CI_COMMIT_TAG:1}"
release:package:
only:
- tags
when: manual
stage: release
image: alpine:latest
before_script:
- chmod +x ./release.sh
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.nju.edu.cn/g' /etc/apk/repositories
- apk add zip
script:
- ./release.sh package release.zip development-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA} ${CI_COMMIT_TAG:1}
artifacts:
paths:
- ./release.zip