-
Notifications
You must be signed in to change notification settings - Fork 76
/
.gitlab-ci.yml
125 lines (107 loc) · 2.68 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
stages:
- build
- build2
- deploy
variables:
GIT_DEPTH: "1"
.docker-op:
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
.docker-x86:
extends: .docker-op
tags:
- docker
variables:
ARCH: x86
.docker-arm:
extends: .docker-op
tags:
- docker-arm
variables:
ARCH: arm
.build_lite:
stage: build
script:
- docker build --pull --no-cache -f ./Dockerfile.lite -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-lite .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-lite
build_lite_x86:
extends:
- .docker-x86
- .build_lite
build_lite_arm:
extends:
- .docker-arm
- .build_lite
.build_full:
stage: build2
script:
- docker build --build-arg BASE_IMAGE=$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-lite --pull --no-cache -t
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-full .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-full
build_full_x86:
extends:
- .docker-x86
- .build_full
build_full_arm:
extends:
- .docker-arm
- .build_full
.deploy_image:
stage: deploy
extends: .docker-x86
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-$DEPLOY_TYPE
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm-$DEPLOY_TYPE
- docker manifest create $CI_REGISTRY_IMAGE:$DEPLOY_TAG $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-$DEPLOY_TYPE $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm-$DEPLOY_TYPE
- docker manifest push $CI_REGISTRY_IMAGE:$DEPLOY_TAG
deploy_lite:
extends: .deploy_image
variables:
DEPLOY_TYPE: lite
DEPLOY_TAG: $CI_COMMIT_REF_SLUG-lite
deploy_full:
extends: .deploy_image
variables:
DEPLOY_TYPE: full
DEPLOY_TAG: $CI_COMMIT_REF_SLUG-full
deploy_branch:
extends: .deploy_image
variables:
DEPLOY_TYPE: full
DEPLOY_TAG: $CI_COMMIT_REF_SLUG
deploy_latest_lite:
extends: .deploy_image
variables:
DEPLOY_TYPE: lite
DEPLOY_TAG: lite
only:
- master
deploy_latest_full:
extends: .deploy_image
variables:
DEPLOY_TYPE: full
DEPLOY_TAG: full
only:
- master
deploy_latest:
extends: .deploy_image
variables:
DEPLOY_TYPE: full
DEPLOY_TAG: latest
only:
- master
upload_stuff_to_minio:
stage: deploy
tags:
- linux
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-full
script:
- apt update ; apt -y install python3-pip
- pip3 install -U -i https://mirrors.aliyun.com/pypi/simple/ awscli
- cd /ygopro-server
- mkdir /dist
- tar zcfv /dist/ygopro-server.tar.gz ./*
- aws s3 --endpoint=https://minio.mycard.moe:9000 cp
/dist/ygopro-server.tar.gz s3://mycard/srvpro/ygopro-server.tar.gz
only:
- master