-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·53 lines (47 loc) · 1.76 KB
/
update.sh
File metadata and controls
executable file
·53 lines (47 loc) · 1.76 KB
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
#!/usr/bin/env bash
set -Eeuox pipefail
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
distrs=("$@")
if [ ${#distrs[@]} -eq 0 ]; then
GLOBIGNORE=".*:latest/"
distrs=(*/)
fi
distrs=("${distrs[@]%/}")
php_versions="5.6 7.4 8.1 8.2 8.3 8.4"
for distr in "${distrs[@]}"; do
for suite in "$distr"/*; do
suite=${suite##*/}
versions=$(wget -O - "https://packages.nginx.org/unit/$distr/pool/unit/u/unit/" | sed -n -E -e "s/<a.+?>unit_(.+?)~${suite}_amd64.deb<\/a>.*/\1/p" | sort -u | grep -v "1\.3[0-2]")
if [ "$distr" = "debian" ]; then
image_suffix="-slim"
else
image_suffix=""
fi
for ver in $versions; do
for php_ver in $php_versions; do
dst_dir="${distr}/${suite}/${suite}-${ver}-php${php_ver}/"
mkdir -p "$dst_dir"
cp *.sh "$dst_dir"
rm -f "${dst_dir}update.sh"
dockerfile="${dst_dir}Dockerfile"
template="Dockerfile.$distr.$suite.$php_ver.template"
if [ ! -r "$template" ]; then
template="Dockerfile.$distr.$suite.template"
fi
if [ ! -r "$template" ]; then
template="Dockerfile.$distr.template"
fi
if [ ! -r "$template" ]; then
template="Dockerfile.template"
fi
sed -r \
-e 's/%%DISTR%%/'"$distr"'/' \
-e 's/%%SUITE%%/'"$suite"'/' \
-e 's/%%VERSION%%/'"$ver"'/' \
-e 's/%%IMAGE_SUFFIX%%/'"$image_suffix"'/' \
-e 's/%%PHP_VER%%/'"$php_ver"'/' \
"$template" >"$dockerfile"
done
done
done
done