From 529af2510d25ba444d8959c3c37252f699705103 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sat, 6 Nov 2021 14:09:00 +0200 Subject: [PATCH] WebDAV image. --- .gitlab-ci.yml | 16 ++++++++++++++++ webdav/.dockerignore | 3 +++ webdav/Dockerfile | 11 +++++++++++ webdav/README.md | 22 ++++++++++++++++++++++ webdav/webdav-readonly.conf | 4 ++++ webdav/webdav.conf | 8 ++++++++ 6 files changed, 64 insertions(+) create mode 100644 webdav/.dockerignore create mode 100644 webdav/Dockerfile create mode 100644 webdav/README.md create mode 100644 webdav/webdav-readonly.conf create mode 100644 webdav/webdav.conf diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d75c87..72f6d36 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -116,3 +116,19 @@ push-sleep: needs: - job: build-sleep artifacts: true + +# webdav image: + +build-webdav: + extends: .container-build + variables: + CONTEXT: webdav + +push-webdav: + extends: .container-push + variables: + CONTEXT: webdav + IMAGE: webdav + needs: + - job: build-webdav + artifacts: true diff --git a/webdav/.dockerignore b/webdav/.dockerignore new file mode 100644 index 0000000..80fcc28 --- /dev/null +++ b/webdav/.dockerignore @@ -0,0 +1,3 @@ +* +!webdav.conf +!webdav-readonly.conf diff --git a/webdav/Dockerfile b/webdav/Dockerfile new file mode 100644 index 0000000..22c5fe7 --- /dev/null +++ b/webdav/Dockerfile @@ -0,0 +1,11 @@ +FROM registry.shore.co.il/httpd:bullseye +USER root +RUN a2enmod dav && \ + a2enmod dav_fs && \ + a2enmod dav_lock && \ + install -d -m 750 -o root -g www-data /var/www/webdav && \ + rm -rf /tmp/* /var/tmp/* +COPY --chown=root:root webdav.conf /etc/apache2/conf-enabled/ +COPY --chown=root:root webdav-readonly.conf /etc/apache2/conf-enabled/ +USER www-data +RUN apache2 -t diff --git a/webdav/README.md b/webdav/README.md new file mode 100644 index 0000000..fec881d --- /dev/null +++ b/webdav/README.md @@ -0,0 +1,22 @@ +# WebDAV container image + +Apache2 with WebDAV enabled and configured. + +## Usage + +The directory that is shared is `/var/www/webdav`, so mount something there. + +``` +docker run -v '/mnt/foo:/var/www/webdav' -p 80:80 registry.shore.co.il/webdav +``` + +This image allows read-only access by default. If you want to change that build +your own image and delete `/etc/apache2/conf-enabled/webdav-readonly.conf` like +so: + +``` +FROM registry.shore.co.il/webdav +USER root +RUN rm /etc/apache2/conf-enabled/webdav-readonly.conf +USER www-data +``` diff --git a/webdav/webdav-readonly.conf b/webdav/webdav-readonly.conf new file mode 100644 index 0000000..86bbeaf --- /dev/null +++ b/webdav/webdav-readonly.conf @@ -0,0 +1,4 @@ +# vim: ft=apache +<Directory /var/www/webdav> + Require method GET OPTIONS PROPFIND +</Directory> diff --git a/webdav/webdav.conf b/webdav/webdav.conf new file mode 100644 index 0000000..79ab70e --- /dev/null +++ b/webdav/webdav.conf @@ -0,0 +1,8 @@ +# vim: ft=apache + +Alias /webdav /var/www/webdav +RedirectMatch "^/$" /webdav + +<Location /webdav> + Dav On +</Location> -- GitLab