docker-images/images/kiwix/run.sh

27 lines
647 B
Bash
Executable File

#!/usr/bin/env bash
mode="$1";
shift;
echo ">>> Environment:";
echo "[wrapper] NOMAD_PORT_KIWIX=$NOMAD_PORT_KIWIX";
echo "[wrapper] Mode: ${mode}";
echo "[wrapper] Args: $*";
echo ">>> Checking environment";
if [[ -z "${NOMAD_PORT_KIWIX}" ]]; then
echo "Error: The environment variable NOMAD_PORT_KIWIX is not set. It must be set to the port number to listen on." >&2;
fi
echo ">>> Starting kiwix";
case "${mode}" in
serve )
echo ">>> kiwix-serve --library --port ${NOMAD_PORT_KIWIX} /srv/data";
/app/kiwix-serve --library --port "${NOMAD_PORT_KIWIX}" /srv/data;
;;
* )
echo ">>> kiwix-serve $*";
/app/kiwix-serve "$@";
;;
esac