diff --git a/Dockerfile b/Dockerfile index 0377e6c..e144e0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,5 +3,17 @@ WORKDIR /app COPY ./build/libs/* ./nextcloud-dlna.jar +RUN set -ex; \ + export DEBIAN_FRONTEND=noninteractive; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + tzdata \ + netcat-openbsd \ + ; \ + rm -rf /var/lib/apt/lists/*; + +COPY --chmod=775 start.sh /start.sh + EXPOSE 8080 +ENTRYPOINT ["/start.sh"] CMD ["java","-jar","nextcloud-dlna.jar"] diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..7671296 --- /dev/null +++ b/start.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Wait for Nextcloud to come online +if [ -n "$NC_DOMAIN" ] && [ -n "$NC_PORT" ]; then + while ! nc -z "$NC_DOMAIN" "$NC_PORT"; do + echo "Waiting for Nextcloud to start on $NC_DOMAIN:$NC_PORT..." + sleep 5 + done + echo "Nextcloud found on $NC_DOMAIN:$NC_PORT!" +fi + +# Execute CMD +exec /__cacert_entrypoint.sh "$@"