Merge pull request #17 from szaimen/master

create wrapper script in order to wait for Nextcloud to start
This commit is contained in:
xis 2023-10-31 17:01:57 +01:00 committed by GitHub
commit d31e30aa68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -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"]

13
start.sh Normal file
View file

@ -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 "$@"