services/templates/traefik/entrypoint.sh.gotmpl

30 lines
851 B
Go Template
Raw Normal View History

2022-11-18 15:08:16 +00:00
#!/bin/sh
2022-11-18 15:08:16 +00:00
set -e
# Create the dynamic config directory in the shared volume.
mkdir -p {{ .Traefik.SharedMountPoint }}/dynamic
chgrp {{ .FlowGID }} {{ .Traefik.SharedMountPoint }}/dynamic
chmod a-rwx,u+rwx,g+rwx {{ .Traefik.SharedMountPoint }}/dynamic
2022-11-18 15:08:16 +00:00
# Move the dashboard config to the new directory.
if [ -f /tmp/dynamic_dashboard.yaml ]; then
mv /tmp/dynamic_dashboard.yaml {{ .Traefik.SharedMountPoint }}/dynamic/dynamic_dashboard.yaml
2022-11-18 15:08:16 +00:00
fi
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- traefik "$@"
fi
# if our command is a valid Traefik subcommand, let's invoke it through Traefik instead
# (this allows for "docker run traefik version", etc)
if traefik "$1" --help >/dev/null 2>&1
then
set -- traefik "$@"
else
echo "= '$1' is not a Traefik command: assuming shell execution." 1>&2
fi
exec "$@"