5 Commits
0.3.0 ... 0.3.1

7 changed files with 39 additions and 28 deletions

View File

@ -25,13 +25,13 @@ EXPOSE 80
VOLUME [ "/var/www/webdav" ] VOLUME [ "/var/www/webdav" ]
COPY password.sh / COPY entrypoint.sh /
COPY VERSION / COPY VERSION /
COPY webdav.conf /etc/nginx/sites-enabled/webdav COPY webdav.conf /etc/nginx/sites-enabled/webdav
ENTRYPOINT ["/password.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

View File

@ -30,10 +30,11 @@ Runs a Nginx WebDav server in Docker
- `X.X.X`: [Semantic version](https://semver.org/) (use if you want to stick on a specific version) - `X.X.X`: [Semantic version](https://semver.org/) (use if you want to stick on a specific version)
### Environment variables ### Environment variables
| Variable | Required? | Definition | Example | Comments | | Variable | Required? | Definition | Example | Comments |
|-------------|-----------|----------------------------------|----------------------------|--------------------------------------------------------------| |----------------------------|--------------------|----------------------------------------------------------------------------------------------------------------|----------------------------|--------------------------------------------------------------|
| WEBDAV_USER | No | WebDav username | user | user AND pass need to be set for authentication to work | | WEBDAV_USER | No | WebDav username | user | user AND pass need to be set for authentication to work |
| WEBDAV_PASS | No | WebDav password | password1 | user AND pass need to be set for authentication to work | | WEBDAV_PASS | No | WebDav password | password1 | user AND pass need to be set for authentication to work |
| NGINX_CLIENT_MAX_BODY_SIZE | No (default: 250M) | Nginx's [client_max_body_size](https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size) | 500M | Be sure to include the units. Set to `0` to disable. |
### Ports ### Ports
| Port on host | Port in container | Comments | | Port on host | Port in container | Comments |
@ -56,6 +57,7 @@ services:
environment: environment:
- WEBDAV_USER=user - WEBDAV_USER=user
- WEBDAV_PASS=password1 - WEBDAV_PASS=password1
- NGINX_CLIENT_MAX_BODY_SIZE=500M
networks: networks:
- webdav - webdav
ports: ports:

View File

@ -1 +1 @@
0.3.0 0.3.1

View File

@ -9,6 +9,7 @@ services:
environment: environment:
- WEBDAV_USER=user - WEBDAV_USER=user
- WEBDAV_PASS=password1 - WEBDAV_PASS=password1
- NGINX_CLIENT_MAX_BODY_SIZE=500M
networks: networks:
- webdav - webdav
ports: ports:

27
entrypoint.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh -e
printf "########################################\n"
printf "# Container starting up!\n"
printf "########################################\n"
# Check for WebDav user/pass
printf "# STATE: Checking for WebDav user/pass\n"
if [ -n "$WEBDAV_USER" ] && [ -n "$WEBDAV_PASS" ]
then
printf "# STATE: WebDav user/pass written to /etc/nginx/webdav_credentials\n"
htpasswd -b -c /etc/nginx/webdav_credentials $WEBDAV_USER $WEBDAV_PASS > /dev/null 2>&1
else
printf "# WARN: No WebDav user/pass were set, the "restricted" directory has no authentication on it!\n"
sed -i "s/.*auth_basic.*//g" /etc/nginx/sites-enabled/webdav
sed -i "s/.*auth_basic_user_file.*//g" /etc/nginx/sites-enabled/webdav
fi
# Check for client_max_body_size setting
if [ -n "$NGINX_CLIENT_MAX_BODY_SIZE" ]
then
printf "# STATE: Setting client_max_body_size to $NGINX_CLIENT_MAX_BODY_SIZE\n"
sed -i "s/client_max_body_size 250M;/client_max_body_size $NGINX_CLIENT_MAX_BODY_SIZE;/g" /etc/nginx/sites-enabled/webdav
fi
printf "# STATE: Nginx is starting up now, the logs you see below are error_log and access_log from Nginx\n"
exec "$@"

View File

@ -1,21 +0,0 @@
#!/bin/sh -e
printf "#####\n"
printf "# Container starting up!\n"
printf "#####\n"
# Check for WebDav user/pass
printf "# STATE: Checking for WebDav user/pass\n"
if [ -n "$WEBDAV_USER" ] && [ -n "$WEBDAV_PASS" ]
then
printf "# STATE: WebDav user/pass written to /etc/nginx/webdav_credentials\n"
htpasswd -b -c /etc/nginx/webdav_credentials $WEBDAV_USER $WEBDAV_PASS > /dev/null 2>&1
else
printf "# WARN: No WebDav user/pass were set, the 'restricted' diretory has no authentication on it!\n"
sed -i 's/.*auth_basic.*//g' /etc/nginx/sites-enabled/webdav
sed -i 's/.*auth_basic_user_file.*//g' /etc/nginx/sites-enabled/webdav
fi
printf "# STATE: Nginx is starting up now, the logs you see below are error_log and access_log from Nginx\n"
exec "$@"

View File

@ -5,6 +5,8 @@ server {
root /var/www/webdav; root /var/www/webdav;
autoindex on; autoindex on;
client_max_body_size 250M;
location /public { location /public {
dav_methods PUT DELETE MKCOL COPY MOVE; dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS; dav_ext_methods PROPFIND OPTIONS;