-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathazure-pipelines.yml.back
309 lines (286 loc) · 9.66 KB
/
azure-pipelines.yml.back
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
branches:
include:
- master
tags:
include:
- 7.*
# pr:
# - master
jobs:
- job: build
strategy:
maxParallel: 1
matrix:
# PHP_73_CLI:
# PHP_VERSION: 7_3_X
# FOLDER: 7.3
# PHP_TAG_VERSION: 7.3.25
# TYPE: CLI
# PHP_73_FPM:
# PHP_VERSION: 7_3_X
# FOLDER: 7.3
# PHP_TAG_VERSION: 7.3.25
# TYPE: FPM
# PHP_73_COMPOSER:
# PHP_VERSION: 7_3_X
# FOLDER: 7.3
# PHP_TAG_VERSION: 7.3.25
# TYPE: COMPOSER
# PHP_73_SWOOLE:
# PHP_VERSION: 7_3_X
# FOLDER: 7.3
# PHP_TAG_VERSION: 7.3.25
# TYPE: SWOOLE
# PHP_73_UNIT:
# PHP_VERSION: 7_3_X
# FOLDER: 7.3
# PHP_TAG_VERSION: 7.3.25
# TYPE: UNIT
# PHP_73_SUPERVISORD:
# PHP_VERSION: 7_3_X
# FOLDER: 7.3
# PHP_TAG_VERSION: 7.3.25
# TYPE: SUPERVISORD
# PHP_73_PPM:
# PHP_VERSION: 7_3_X
# FOLDER: 7.3
# PHP_TAG_VERSION: 7.3.25
# TYPE: PPM
# PHP_56_FPM:
# PHP_VERSION: 5_6_X
# FOLDER: 5.6
# PHP_TAG_VERSION: 5.6.40
# TYPE: FPM
# PHP_70_FPM:
# PHP_VERSION: 7_0_X
# FOLDER: 7.0
# PHP_TAG_VERSION: 7.0.33
# TYPE: FPM
# PHP_71_FPM:
# PHP_VERSION: 7_1_X
# FOLDER: 7.1
# PHP_TAG_VERSION: 7.1.33
# TYPE: FPM
PHP_72_CLI:
PHP_VERSION: 7_2_X
FOLDER: 7.2
PHP_TAG_VERSION: 7.2.34
TYPE: CLI
PHP_72_FPM:
PHP_VERSION: 7_2_X
FOLDER: 7.2
PHP_TAG_VERSION: 7.2.34
TYPE: FPM
PHP_72_COMPOSER:
PHP_VERSION: 7_2_X
FOLDER: 7.2
PHP_TAG_VERSION: 7.2.34
TYPE: COMPOSER
PHP_72_SWOOLE:
PHP_VERSION: 7_2_X
FOLDER: 7.2
PHP_TAG_VERSION: 7.2.34
TYPE: SWOOLE
PHP_72_UNIT:
PHP_VERSION: 7_2_X
FOLDER: 7.2
PHP_TAG_VERSION: 7.2.34
TYPE: UNIT
PHP_72_SUPERVISORD:
PHP_VERSION: 7_2_X
FOLDER: 7.2
PHP_TAG_VERSION: 7.2.34
TYPE: SUPERVISORD
# PHP_72_PPM:
# PHP_VERSION: 7_2_X
# FOLDER: 7.2
# PHP_TAG_VERSION: 7.2.34
# TYPE: PPM
# PHP_74_CLI:
# PHP_VERSION: 7_4_X
# FOLDER: 7.4
# PHP_TAG_VERSION: 7.4.13
# TYPE: CLI
# PHP_74_FPM:
# PHP_VERSION: 7_4_X
# FOLDER: 7.4
# PHP_TAG_VERSION: 7.4.13
# TYPE: FPM
# PHP_74_COMPOSER:
# PHP_VERSION: 7_4_X
# FOLDER: 7.4
# PHP_TAG_VERSION: 7.4.13
# TYPE: COMPOSER
# PHP_74_SWOOLE:
# PHP_VERSION: 7_4_X
# FOLDER: 7.4
# PHP_TAG_VERSION: 7.4.13
# TYPE: SWOOLE
# PHP_nightly_CLI:
# PHP_VERSION: nightly
# FOLDER: nightly
# PHP_TAG_VERSION: nightly
# TYPE: CLI
# PHP_nightly_FPM:
# PHP_VERSION: nightly
# FOLDER: nightly
# PHP_TAG_VERSION: nightly
# TYPE: FPM
# PHP_nightly_COMPOSER:
# PHP_VERSION: nightly
# FOLDER: nightly
# PHP_TAG_VERSION: nightly
# TYPE: COMPOSER
# PHP_nightly_SWOOLE:
# PHP_VERSION: nightly
# FOLDER: nightly
# PHP_TAG_VERSION: nightly
# TYPE: SWOOLE
pool:
vmImage: 'ubuntu-latest'
variables:
- group: docker
- name: DOCKER_COMPOSE_VERSION
value: 1.29.0
timeoutInMinutes: 0
steps:
- script: |
set -x
env
docker --version
docker compose version
displayName: 'manifest'
- script: |
set -x
export DOCKER_CHANNEL=test
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) ${DOCKER_CHANNEL}"
sudo apt-get update
sudo apt-get -y install docker-ce
docker compose version
sudo mkdir -p /etc/systemd/system/docker.service.d
echo -e '[Service]\nExecStart=\nExecStart=/usr/bin/dockerd' | sudo tee /etc/systemd/system/docker.service.d/docker.conf
echo '{"hosts":["unix:///var/run/docker.sock","tcp://0.0.0.0:2375"],"experimental":true}' | sudo tee /etc/docker/daemon.json
sudo systemctl daemon-reload
sudo systemctl cat docker
sudo systemctl restart docker
sleep 5
docker run --rm --privileged tonistiigi/binfmt:latest --install all
ls -la /proc/sys/fs/binfmt_misc
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
displayName: 'Setup Docker'
- script: |
set -x
docker --version
docker compose version
docker buildx version
docker
displayName: 'install-after-manifest'
- script: |
set -x
echo $(DOCKER_PASSWORD) | docker login -u $(DOCKER_USERNAME) --password-stdin
# echo $(DOCKER_PASSWORD) | docker login -u $(TENCENT_DOCKER_USERNAME) --password-stdin uswccr.ccs.tencentyun.com
echo $(DOCKER_PASSWORD) | docker login -u $(ALIYUN_DOCKER_USERNAME) --password-stdin registry.us-east-1.aliyuncs.com
echo $(GITHUB_TOKEN) | docker login -u khs1994 --password-stdin ghcr.io
displayName: 'Docker Login'
- bash: |
cp .env.example .env
set -ex
if [ ! `echo $BUILD_SOURCEBRANCH | grep 'refs/tags/'` ];then \
export PLATFORM=linux/amd64; \
if [ "$PHP_VERSION" = 8_1_X -o "$PHP_VERSION" = nightly ];then \
export PLATFORM=linux/amd64,linux/arm64,linux/arm/v7; \
IS_PUSH=--push; \
mirror="${add_mirror}"; \
else \
IS_PUSH=--push; \
DOCKER_HUB_USERNAME=${DOCKER_HUB_USERNAME_TEST}; \
fi; \
else \
IS_PUSH=--push \
&& mirror="${add_mirror}"; \
fi
VCS_REF=`git rev-parse --short HEAD`
# CACHE_IMAGE=ghcr.io/khs1994-docker/php
CACHE_IMAGE=${DOCKER_HUB_USERNAME}/php
options="--build-arg USERNAME=$DOCKER_HUB_USERNAME \
--build-arg VCS_REF=$VCS_REF \
--cache-from=khs1994/php:${FOLDER}-arm-${TYPE,,}-cache \
--cache-from=${CACHE_IMAGE}:${FOLDER}-${TYPE,,}-cache \
--cache-to=${CACHE_IMAGE}:${FOLDER}-${TYPE,,}-cache"
echo $options
if [ "$TYPE" = "UNIT" ];then
docker buildx build $options \
--build-arg ALPINE_URL=${ALPINE_URL:-dl-cdn.alpinelinux.org} \
-t $DOCKER_HUB_USERNAME/php:${PHP_TAG_VERSION}-unit-alpine \
$(for item in `echo $mirror`;do echo " -t ${item}:${PHP_TAG_VERSION}-unit-alpine ";done) \
--platform ${PLATFORM} \
${IS_PUSH} ${FOLDER}/unit
fi
if [ "$TYPE" = "SUPERVISORD" ];then
docker buildx build $options \
--build-arg ALPINE_URL=${ALPINE_URL:-dl-cdn.alpinelinux.org} \
-t $DOCKER_HUB_USERNAME/php:${PHP_TAG_VERSION}-supervisord-alpine \
$(for item in `echo $mirror`;do echo " -t ${item}:${PHP_TAG_VERSION}-supervisord-alpine ";done) \
--platform ${PLATFORM} ${IS_PUSH} ${FOLDER}/supervisord
fi
if [ "$TYPE" = "COMPOSER" ];then
docker buildx build $options \
--build-arg ALPINE_URL=${ALPINE_URL:-dl-cdn.alpinelinux.org} \
-t $DOCKER_HUB_USERNAME/php:${PHP_TAG_VERSION}-composer-alpine \
$(for item in `echo $mirror`;do echo " -t ${item}:${PHP_TAG_VERSION}-composer-alpine ";done) \
--platform ${PLATFORM} ${IS_PUSH} ${FOLDER}/composer
fi
if [ "$TYPE" = "SINGLE" ];then
docker buildx build $options \
--build-arg ALPINE_URL=${ALPINE_URL:-dl-cdn.alpinelinux.org} \
-t $DOCKER_HUB_USERNAME/php:${PHP_TAG_VERSION}-single-alpine \
${IS_PUSH} ${FOLDER}/single
fi
if [ "$TYPE" = "SWOOLE" ];then
docker buildx build $options \
--build-arg ALPINE_URL=${ALPINE_URL:-dl-cdn.alpinelinux.org} \
-t $DOCKER_HUB_USERNAME/php:${PHP_TAG_VERSION}-swoole-alpine \
$(for item in `echo $mirror`;do echo " -t ${item}:${PHP_TAG_VERSION}-swoole-alpine ";done) \
--platform ${PLATFORM} ${IS_PUSH} ${FOLDER}/swoole
fi
if [ "$TYPE" = "FPM" ];then
docker buildx build $options \
--build-arg ALPINE_URL=${ALPINE_URL:-dl-cdn.alpinelinux.org} \
--target=php -t $DOCKER_HUB_USERNAME/php:${PHP_TAG_VERSION}-fpm-alpine \
$(for item in `echo $mirror`;do echo " -t ${item}:${PHP_TAG_VERSION}-fpm-alpine ";done) \
${fpmTagOptions} \
--platform ${PLATFORM} \
${IS_PUSH} ${FOLDER}/fpm
fi
if [ "$TYPE" = "CLI" ];then
docker buildx build $options \
--build-arg ALPINE_URL=${ALPINE_URL:-dl-cdn.alpinelinux.org} \
-t $DOCKER_HUB_USERNAME/php:${PHP_TAG_VERSION}-cli-alpine \
$(for item in `echo $mirror`;do echo " -t ${item}:${PHP_TAG_VERSION}-cli-alpine ";done) \
--platform ${PLATFORM} \
${IS_PUSH} ${FOLDER}/cli
fi
if [ "$TYPE" = "PPM" ];then
docker buildx build $options \
--build-arg ALPINE_URL=${ALPINE_URL:-dl-cdn.alpinelinux.org} \
-t $DOCKER_HUB_USERNAME/php:${PHP_TAG_VERSION}-ppm-alpine \
$(for item in `echo $mirror`;do echo " -t ${item}:${PHP_TAG_VERSION}-ppm-alpine ";done) \
--platform ${PLATFORM} \
${IS_PUSH} ${FOLDER}/ppm
fi
env:
DOCKER_HUB_USERNAME: khs1994
DOCKER_HUB_USERNAME_TEST: lrew
PLATFORM: linux/amd64,linux/arm64,linux/arm/v7
# registry.us-west-1.aliyuncs.com/khs1994/php
add_mirror: registry.us-east-1.aliyuncs.com/khs1994-us/php # ghcr.io/khs1994/php
displayName: 'Build Image'
timeoutInMinutes: 0