Skip to content

Instantly share code, notes, and snippets.

@alipandidan
Created August 10, 2019 15:56
Show Gist options
  • Save alipandidan/af6b0997b2e7570cf2c3aaa642b8d3ec to your computer and use it in GitHub Desktop.
Save alipandidan/af6b0997b2e7570cf2c3aaa642b8d3ec to your computer and use it in GitHub Desktop.
Suitable entrypoint for docker
#!/bin/sh
set -e
if [ $(echo "$1" | cut -c1) = "-" ]; then
echo "$0: assuming arguments"
set -- myapp "$@"
fi
if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "myapp" ]; then
echo "$0: setting data directory to $MYAPP_DATA"
set -- "$@" -datadir="$MYAPP_DATA"
fi
if [ "$1" = "myappcli" ] || [ "$1" = "yourappcli" ]; then
echo
exec gosu myappcli "$@"
fi
echo
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment