diff --git a/images/kiwix/Dockerfile b/images/kiwix/Dockerfile index af0deef..15b42fe 100644 --- a/images/kiwix/Dockerfile +++ b/images/kiwix/Dockerfile @@ -24,3 +24,5 @@ WORKDIR /app USER 10600:10600 ENTRYPOINT [ "/srv/run.sh" ] + +CMD [ "serve" ] \ No newline at end of file diff --git a/images/kiwix/run.sh b/images/kiwix/run.sh index aee63a4..0654c9c 100755 --- a/images/kiwix/run.sh +++ b/images/kiwix/run.sh @@ -1,13 +1,26 @@ #!/usr/bin/env bash -echo ">>> Environment:" -echo "[wrapper] NOMAD_PORT_KIWIX=$NOMAD_PORT_KIWIX" -echo "[wrapper] Args: $*" +mode="$1"; +shift; -echo ">>> Checking environment" +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"; -/app/kiwix-serve --library --port "${NOMAD_PORT_KIWIX}" /srv/data; \ No newline at end of file +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