Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit fd1e716

Browse files
committed
Initial commit
0 parents  commit fd1e716

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

Diff for: Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ubuntu:trusty
2+
3+
RUN apt-get update && apt-get install -y nginx nginx-extras apache2-utils
4+
5+
ENV USERNAME="" PASSWORD=""
6+
7+
VOLUME /media
8+
COPY webdav.conf /etc/nginx/conf.d/default.conf
9+
RUN rm /etc/nginx/sites-enabled/*
10+
11+
COPY entrypoint.sh /
12+
RUN chmod +x entrypoint.sh
13+
CMD /entrypoint.sh && nginx -g "daemon off;"

Diff for: docker-compose.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '2'
2+
services:
3+
webdav:
4+
build: .
5+
ports:
6+
- "80:80"
7+
volumes:
8+
- "/mnt:/media"
9+
environment:
10+
USERNAME: user
11+
PASSWORD: passwd

Diff for: entrypoint.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
if [[ -n "$USERNAME" ]] && [[ -n "$PASSWORD" ]]
4+
then
5+
htpasswd -bc /etc/nginx/htpasswd $USERNAME $PASSWORD
6+
echo Done.
7+
else
8+
echo Using no auth.
9+
sed -i 's%auth_basic "Restricted";% %g' /etc/nginx/conf.d/default.conf
10+
sed -i 's%auth_basic_user_file htpasswd;% %g' /etc/nginx/conf.d/default.conf
11+
fi

Diff for: webdav.conf

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
server {
3+
listen 80;
4+
5+
access_log /dev/stdout;
6+
error_log /dev/stdout info;
7+
8+
client_max_body_size 0;
9+
10+
location / {
11+
create_full_put_path on;
12+
autoindex on;
13+
autoindex_exact_size off;
14+
autoindex_localtime on;
15+
charset utf-8;
16+
17+
dav_methods PUT DELETE MKCOL COPY MOVE;
18+
dav_ext_methods PROPFIND OPTIONS;
19+
dav_access user:rw group:rw all:rw;
20+
21+
auth_basic "Restricted";
22+
auth_basic_user_file /etc/nginx/htpasswd;
23+
24+
root /media/;
25+
}
26+
}

0 commit comments

Comments
 (0)