services/templates/traefik/entrypoint.sh
2022-11-18 15:08:16 +00:00

28 lines
839 B
Bash

#!/bin/sh
set -e
# Create the dynamic config directory in the shared volume.
mkdir -p ${TRAEFIK_SHARED_MOUNT_POINT}/dynamic
chgrp ${FLOW_GID} ${TRAEFIK_SHARED_MOUNT_POINT}/dynamic
chmod a-rwx,u+rwx,g+rwx ${TRAEFIK_SHARED_MOUNT_POINT}/dynamic
# Move the dashboard config to the new directory.
if [ -f /tmp/dynamic_dashboard.yaml ]; then
mv /tmp/dynamic_dashboard.yaml ${TRAEFIK_SHARED_MOUNT_POINT}/dynamic/dynamic_dashboard.yaml
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 "$@"