-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-entrypoint.sh
executable file
·45 lines (35 loc) · 1.48 KB
/
docker-entrypoint.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
# Exit the script as soon as something fails.
set -e
ARGS=$@
# NGROK_AUTH - Authentication key for your Ngrok account. This is needed for custom subdomains, custom domains, and HTTP authentication.
# NGROK_SUBDOMAIN - Name of the custom subdomain to use for your tunnel. You must also provide the authentication token.
# NGROK_HOSTNAME - Paying Ngrok customers can specify a custom domain. Only one subdomain or domain can be specified, with the domain taking priority.
# NGROK_PROTOCOL - Can either be HTTP or TCP, and it defaults to HTTP if not specified. If set to TCP, Ngrok will allocate a port instead of a subdomain and proxy TCP requests directly to your application.
# NGROK_PORT - Port to expose (defaults to 80 for HTTP protocol).
NGROK_OPTIONS="--config=/ngrok/ngrok.yml"
if [ -z $NGROK_PROTOCOL ]; then
NGROK_PROTOCOL=http
fi
if [ -z $NGROK_PORT ]; then
NGROK_PORT=80
fi
if [ -z $NGROK_TARGET ]; then
NGROK_TARGET=172.17.42.1
fi
if [ ! -z $NGROK_AUTH ]; then
./ngrok config add-authtoken $NGROK_AUTH $NGROK_OPTIONS
fi
if [[ "$ARGS" == "" ]]; then
if [ ! -z $NGROK_HOSTNAME ]; then
NGROK_OPTIONS="$NGROK_OPTIONS --hostname=${NGROK_HOSTNAME}"
elif [ ! -z $NGROK_SUBDOMAIN ]; then
NGROK_OPTIONS="$NGROK_OPTIONS --subdomain=${NGROK_SUBDOMAIN}"
fi
./ngrok $NGROK_PROTOCOL $NGROK_OPTIONS $NGROK_TARGET:$NGROK_PORT
elif [ -x $ARGS ]; then
exec "$ARGS"
else
./ngrok $ARGS
# Execute the CMD from the Dockerfile and pass in all of its arguments.
fi