forked from traefik/traefik-library-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.sh
executable file
·37 lines (27 loc) · 1.02 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
#!/usr/bin/env bash
set -e
set -u # Exit on error when uninitialized variable
if [ $# -eq 0 ] ; then
echo "Usage: ./update.sh <traefik tag or branch>"
exit
fi
export VERSION=$1
export ALPINE_VERSION=3.15
PLATFORMS=(
"alpine"
"scratch"
"windows/1809"
)
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
PLATFORM_DIR="${SCRIPT_DIRNAME_ABSOLUTEPATH}/${PLATFORM}"
[ -d "${PLATFORM_DIR}" ] || ( echo "= No directory found for ${PLATFORM_DIR}" && exit 1)
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 < "${PLATFORM_DIR}/tmpl${VERSION:0:2}.Dockerfile" > "${PLATFORM_DIR}/Dockerfile"
done
echo "= All Dockerfiles updated."
popd # Browse back to caller dirname