-
-
Notifications
You must be signed in to change notification settings - Fork 203
/
build.sh
executable file
·59 lines (49 loc) · 2.95 KB
/
build.sh
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
#!/usr/bin/env bash
set -e
# determine swoole version to build.
TASK=${1}
CHECK=${!#}
function check_or_push() {
TAG=${1}
if [[ ${CHECK} == "--check" ]]; then
echo "Checking $TAG ..."
version=`docker run hyperf/hyperf:$TAG php -v`
echo $version | grep -Eo "PHP \d+\.\d+\.\d+"
swoole=`docker run hyperf/hyperf:$TAG php --ri swoole` && echo $swoole | grep -Eo "Version => \d+\.\d+\.\d+" || echo "No Swoole."
fi
if [[ ${CHECK} != "--check" ]]; then
echo "Publishing "$TAG" ..."
# Push origin image
docker push hyperf/hyperf:${TAG}
fi
echo -e "\n"
}
# build base image
if [[ ${TASK} == "build" ]]; then
export PHP_VERSION=7.3 && export ALPINE_VERSION=3.10 && docker-compose build alpine-base
export PHP_VERSION=7.3 && export ALPINE_VERSION=3.11 && docker-compose build alpine-base
export PHP_VERSION=7.4 && export ALPINE_VERSION=3.10 && docker-compose build alpine-base
export PHP_VERSION=7.4 && export ALPINE_VERSION=3.11 && docker-compose build alpine-base
export PHP_VERSION=7.4 && export ALPINE_VERSION=3.12 && docker-compose build alpine-base
export PHP_VERSION=7.4 && export ALPINE_VERSION=3.13 && docker-compose build alpine-origin-base
export PHP_VERSION=7.4 && export ALPINE_VERSION=3.14 && docker-compose build alpine-origin-base
export PHP_VERSION=7.4 && export ALPINE_VERSION=3.15 && docker-compose build alpine-origin-base
export PHP_VERSION=8.0 && export ALPINE_VERSION=3.11 && docker-compose build alpine-base
export PHP_VERSION=8.0 && export ALPINE_VERSION=3.12 && docker-compose build alpine-base
export PHP_VERSION=8.0 && export ALPINE_VERSION=3.13 && docker-compose build alpine-origin-base
export PHP_VERSION=8.0 && export ALPINE_VERSION=3.14 && docker-compose build alpine-origin-base
export PHP_VERSION=8.0 && export ALPINE_VERSION=3.15 && docker-compose build alpine-origin-base
export PHP_VERSION=8.0 && export ALPINE_VERSION=3.16 && docker-compose build alpine-origin-base
export PHP_VERSION=8.1 && export ALPINE_VERSION=3.12 && docker-compose build alpine-base
export PHP_VERSION=8.1 && export ALPINE_VERSION=3.13 && docker-compose build alpine-base
export PHP_VERSION=8.1 && export ALPINE_VERSION=3.14 && docker-compose build alpine-base
export PHP_VERSION=8.1 && export ALPINE_VERSION=3.15 && docker-compose build alpine-base
export PHP_VERSION=8.1 && export ALPINE_VERSION=3.16 && docker-compose build alpine-origin-base
fi
if [[ ${TASK} == "publish" ]]; then
# Push base image
TAGS="7.3-alpine-v3.10-base 7.3-alpine-v3.11-base 7.4-alpine-v3.10-base 7.4-alpine-v3.11-base 7.4-alpine-v3.12-base 7.4-alpine-v3.13-base 7.4-alpine-v3.14-base 7.4-alpine-v3.15-base 8.0-alpine-v3.11-base 8.0-alpine-v3.12-base 8.0-alpine-v3.13-base 8.0-alpine-v3.14-base 8.0-alpine-v3.15-base 8.1-alpine-v3.12-base 8.1-alpine-v3.13-base 8.1-alpine-v3.14-base 8.1-alpine-v3.15-base"
for TAG in ${TAGS}; do
check_or_push $TAG
done
fi