diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ad1245d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +Readme.md diff --git a/Dockerfile b/Dockerfile index 4207922..86a67cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine MAINTAINER ViViDboarder RUN apk -Uuv add curl ca-certificates -ADD push.sh /bin/ +COPY push.sh /bin/ RUN chmod +x /bin/push.sh ENTRYPOINT /bin/push.sh diff --git a/push.sh b/push.sh old mode 100644 new mode 100755 index a2d8625..2492530 --- a/push.sh +++ b/push.sh @@ -1,7 +1,16 @@ #! /bin/sh +# Use WEBDAV_USERNAME or WEBDAV_PASSWORD as default, if provided +if [ -z "$PLUGIN_USERNAME" ] && [ ! -z "$WEBDAV_USERNAME" ]; then + PLUGIN_USERNAME="$WEBDAV_USERNAME" +fi +if [ -z "$PLUGIN_PASSWORD" ] && [ ! -z "$WEBDAV_PASSWORD" ]; then + PLUGIN_PASSWORD="$WEBDAV_PASSWORD" +fi + # If username and password are provided, add auth if [ ! -z "$PLUGIN_USERNAME" ] && [ ! -z "$PLUGIN_PASSWORD" ]; then AUTH="-u ${PLUGIN_USERNAME}:${PLUGIN_PASSWORD}" fi + curl -T $PLUGIN_FILE $AUTH $PLUGIN_DESTINATION