-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·75 lines (62 loc) · 1.99 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
BUILD_VERSION=$1
FULL_REBUILD=$2
set -xe
package="slaci/php-fpm"
declare -A latestBugfixVer=([7.0]=33 ["7.1"]=33 ["7.2"]=34 ["7.3"]=33 ["7.4"]=33 ["8.0"]=26 ["8.1"]=13 ["8.2"]=0)
latestVersion="8.2"
if [ -z "${BUILD_VERSION}" ]; then
versions=("8.0" "8.1", "8.2")
else
versions=("${BUILD_VERSION}")
fi
for minorVersion in "${versions[@]}"; do
lastBugfixVer="${latestBugfixVer[$minorVersion]}"
if [ -z "${FULL_REBUILD}" ]; then
versionsToBuild=("${lastBugfixVer}")
else
versionsToBuild=($(seq 0 1 "${lastBugfixVer}"))
fi
for bugfixVersion in "${versionsToBuild[@]}"; do
fullversion="${minorVersion}.${bugfixVersion}"
bugfixTag="${package}:${fullversion}"
xdebugBugfixTag="${bugfixTag}-xdebug"
tagsArg="-t ${bugfixTag}"
xdebugTagsArg="-t ${xdebugBugfixTag}"
tagsToPush="${bugfixTag} ${xdebugBugfixTag}"
isLatestMinor=false
if [ "${bugfixVersion}" -eq "${lastBugfixVer}" ]; then
minorTag="${package}:${minorVersion}"
xdebugMinorTag="${minorTag}-xdebug"
tagsArg="${tagsArg} -t ${minorTag}"
xdebugTagsArg="${xdebugTagsArg} -t ${xdebugMinorTag}"
tagsToPush="${tagsToPush} ${minorTag} ${xdebugMinorTag}"
isLatestMinor=true
fi
if [ "${minorVersion}" = "${latestVersion}" ] && ${isLatestMinor}; then
latestTag="${package}:latest"
tagsArg="$tagsArg -t ${latestTag}"
tagsToPush="${tagsToPush} ${latestTag}"
fi
#--platform linux/amd64,linux/arm64,linux/arm/v7 \
docker buildx build \
--platform linux/amd64 \
--load \
--build-arg FROM_VERSION="${fullversion}" \
--pull \
${tagsArg} \
"${minorVersion}"
docker buildx build \
--platform linux/amd64 \
--load \
--build-arg FROM_VERSION="${fullversion}" \
--build-arg xdebug="1" \
--cache-from "${bugfixTag}" \
${xdebugTagsArg} \
"${minorVersion}"
tagsAry=(${tagsToPush})
for tag in "${tagsAry[@]}"; do
docker push ${tag}
done
done
done