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

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sashgorokhov committed Mar 8, 2016
0 parents commit fd1e716
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ubuntu:trusty

RUN apt-get update && apt-get install -y nginx nginx-extras apache2-utils

ENV USERNAME="" PASSWORD=""

VOLUME /media
COPY webdav.conf /etc/nginx/conf.d/default.conf
RUN rm /etc/nginx/sites-enabled/*

COPY entrypoint.sh /
RUN chmod +x entrypoint.sh
CMD /entrypoint.sh && nginx -g "daemon off;"
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '2'
services:
webdav:
build: .
ports:
- "80:80"
volumes:
- "/mnt:/media"
environment:
USERNAME: user
PASSWORD: passwd
11 changes: 11 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

if [[ -n "$USERNAME" ]] && [[ -n "$PASSWORD" ]]
then
htpasswd -bc /etc/nginx/htpasswd $USERNAME $PASSWORD
echo Done.
else
echo Using no auth.
sed -i 's%auth_basic "Restricted";% %g' /etc/nginx/conf.d/default.conf
sed -i 's%auth_basic_user_file htpasswd;% %g' /etc/nginx/conf.d/default.conf
fi
26 changes: 26 additions & 0 deletions webdav.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

server {
listen 80;

access_log /dev/stdout;
error_log /dev/stdout info;

client_max_body_size 0;

location / {
create_full_put_path on;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
charset utf-8;

dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw all:rw;

auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd;

root /media/;
}
}

0 comments on commit fd1e716

Please sign in to comment.