forked from traefik/traefik-library-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.sh
executable file
·45 lines (35 loc) · 1.31 KB
/
update.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
#!/usr/bin/env bash
set -e
set -u # Exit on error when uninitialized variable
shopt -s extglob
if [ $# -eq 0 ] ; then
echo "Usage: ./update.sh <traefik tag or branch>"
exit
fi
export VERSION=$1
export ALPINE_VERSION=3.20
PLATFORMS=(
"alpine"
"alpine-k8s"
"scratch"
"windows/1809"
"windows/nanoserver-ltsc2022"
"windows/servercore-ltsc2022"
)
SCRIPT_DIRNAME_ABSOLUTEPATH="$(cd "$(dirname "$0")" && pwd -P)"
# cd to the current directory so the script can be run from anywhere.
pushd "${SCRIPT_DIRNAME_ABSOLUTEPATH}"
for PLATFORM in "${PLATFORMS[@]}" ; do
TEMPLATE_DIR="${SCRIPT_DIRNAME_ABSOLUTEPATH}/tmpl/${PLATFORM}"
PLATFORM_DIR="${SCRIPT_DIRNAME_ABSOLUTEPATH}/${VERSION/%.+([0-9a-z\-])/}/${PLATFORM}"
[ -d "${PLATFORM_DIR}" ] || (mkdir -p ${PLATFORM_DIR})
echo "= Generating Dockerfile for platform ${PLATFORM}"
rm -f "${PLATFORM_DIR}/Dockerfile"
# the version of the template is determined by the 2 first chars of the Traefik version passed as argument to this script
envsubst \$ALPINE_VERSION,\$VERSION < "${TEMPLATE_DIR}/tmpl${VERSION:0:2}.Dockerfile" > "${PLATFORM_DIR}/Dockerfile"
if [[ "${PLATFORM}" = "alpine" || "${PLATFORM}" = "alpine-k8s" ]]; then
cp "${TEMPLATE_DIR}/entrypoint.sh" "${PLATFORM_DIR}/entrypoint.sh"
fi
done
echo "= All Dockerfiles updated."
popd # Browse back to caller dirname