Allow arbitrary commands passed to entrypoint

This commit is contained in:
Brad Ison 2018-06-13 13:26:45 -04:00
parent 5ce15348ea
commit 268952a492
No known key found for this signature in database
GPG key ID: 972D14B0BE6DE287
2 changed files with 15 additions and 7 deletions

View file

@ -142,4 +142,4 @@ RUN ./scripts/detect-config.sh
EXPOSE 443 8443 80
ENTRYPOINT [ "/bin/bash", "./quay-entrypoint.sh"]
ENTRYPOINT ["/quay-registry/quay-entrypoint.sh"]

View file

@ -3,8 +3,12 @@
MODE="$1"
display_usage() {
echo "This script takes one argument."
echo -e "\nUsage: ${0} <shell|config|interactive|batch|both>\n"
echo "Usage: ${0} <shell|config|interactive|batch|both>"
echo
echo "If the first argument isn't one of the above modes,"
echo "the arguments will be exec'd directly, i.e.:"
echo
echo " ${0} uptime"
}
if [[ "${MODE}" = "help" ]]
@ -34,26 +38,30 @@ venv/bin/python -m displayversion
case "$MODE" in
"shell")
echo "Entering shell mode"
/bin/bash
exit 0
exec /bin/bash
;;
"config")
echo "Entering config mode, only copying config-app entrypoints"
cp -r ${QUAYDIR}/config_app/init/service/* /etc/service
exec /sbin/my_init
;;
"interactive")
echo "Copying $MODE files"
cp -r ${QUAYCONF}/init/service/interactive/* /etc/service
exec /sbin/my_init
;;
"batch")
echo "Copying $MODE files"
cp -r ${QUAYCONF}/init/service/batch/* /etc/service
exec /sbin/my_init
;;
*)
"")
echo "Copying all files"
cp -r ${QUAYCONF}/init/service/interactive/* /etc/service
cp -r ${QUAYCONF}/init/service/batch/* /etc/service
exec /sbin/my_init
;;
esac
/sbin/my_init
# Not a Quay mode, just exec the args.
exec "$@"