diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d75c87319546cd898348dc8a9c3a854a4b7e220..72f6d362adb94233772b7d441a3fce87e8178872 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/httpd/bullseye/Dockerfile b/httpd/bullseye/Dockerfile index 7fc30770e26d7ca99fd8dbf7d4c27f864635539a..cf65f77033f5851bbe0da2fe9db68313515d9099 100644 --- a/httpd/bullseye/Dockerfile +++ b/httpd/bullseye/Dockerfile @@ -1,4 +1,10 @@ FROM registry.hub.docker.com/library/debian:bullseye-slim +ENV APACHE_RUN_DIR=/run/apache2 \ + APACHE_LOCK_DIR=/var/lock/apache2 \ + APACHE_LOG_DIR=/var/log/apache2 \ + APACHE_RUN_USER=www-data \ + APACHE_RUN_GROUP=www-data \ + APACHE_PID_FILE=/run/apache2/apache2.pid # hadolint ignore=DL3008,DL3015 RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ @@ -9,17 +15,13 @@ RUN apt-get update && \ setcap CAP_NET_BIND_SERVICE=+ep /usr/sbin/apache2 && \ DEBIAN_FRONTEND=noninteractive apt-get purge --auto-remove -y libcap2-bin && \ a2enmod status && \ - install -d -o www-data -g www-data -m 755 /run/apache2 && \ - install -d -o www-data -g www-data -m 755 /var/log/apache2 && \ - ln -sf /dev/stdout /var/log/apache2/access.log && \ - ln -sf /dev/stderr /var/log/apache2/error.log && \ - ln -sf /dev/stdout /var/log/apache2/other_vhosts_access.log && \ + install -d -o "$APACHE_RUN_USER" -g "$APACHE_RUN_GROUP" -m 755 "$APACHE_RUN_DIR" && \ + install -d -o "$APACHE_RUN_USER" -g "$APACHE_RUN_GROUP" -m 755 "$APACHE_LOCK_DIR" && \ + install -d -o "$APACHE_RUN_USER" -g "$APACHE_RUN_GROUP" -m 755 "$APACHE_LOG_DIR" && \ + ln -sf /dev/stdout "$APACHE_LOG_DIR/access.log" && \ + ln -sf /dev/stderr "$APACHE_LOG_DIR/error.log" && \ + ln -sf /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log" && \ rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/* -ENV APACHE_RUN_DIR=/run/apache2 \ - APACHE_LOG_DIR=/var/log/apache2 \ - APACHE_RUN_USER=www-data \ - APACHE_RUN_GROUP=www-data \ - APACHE_PID_FILE=/run/apache2/apache2.pid RUN apache2 -t EXPOSE 80 CMD [ "apache2", "-DFOREGROUND" ] diff --git a/httpd/buster/Dockerfile b/httpd/buster/Dockerfile index 88d945c83c4b5f1f536659ea4f5ac5b0ef045399..d9db471373f1e023af27a47b453c3b5f6437158f 100644 --- a/httpd/buster/Dockerfile +++ b/httpd/buster/Dockerfile @@ -1,4 +1,10 @@ FROM registry.hub.docker.com/library/debian:buster-slim +ENV APACHE_RUN_DIR=/run/apache2 \ + APACHE_LOCK_DIR=/var/lock/apache2 \ + APACHE_LOG_DIR=/var/log/apache2 \ + APACHE_RUN_USER=www-data \ + APACHE_RUN_GROUP=www-data \ + APACHE_PID_FILE=/run/apache2/apache2.pid # hadolint ignore=DL3008,DL3015 RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ @@ -9,17 +15,13 @@ RUN apt-get update && \ setcap CAP_NET_BIND_SERVICE=+ep /usr/sbin/apache2 && \ DEBIAN_FRONTEND=noninteractive apt-get purge --auto-remove -y libcap2-bin && \ a2enmod status && \ - install -d -o www-data -g www-data -m 755 /run/apache2 && \ - install -d -o www-data -g www-data -m 755 /var/log/apache2 && \ - ln -sf /dev/stdout /var/log/apache2/access.log && \ - ln -sf /dev/stderr /var/log/apache2/error.log && \ - ln -sf /dev/stdout /var/log/apache2/other_vhosts_access.log && \ + install -d -o "$APACHE_RUN_USER" -g "$APACHE_RUN_GROUP" -m 755 "$APACHE_RUN_DIR" && \ + install -d -o "$APACHE_RUN_USER" -g "$APACHE_RUN_GROUP" -m 755 "$APACHE_LOCK_DIR" && \ + install -d -o "$APACHE_RUN_USER" -g "$APACHE_RUN_GROUP" -m 755 "$APACHE_LOG_DIR" && \ + ln -sf /dev/stdout "$APACHE_LOG_DIR/access.log" && \ + ln -sf /dev/stderr "$APACHE_LOG_DIR/error.log" && \ + ln -sf /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log" && \ rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/* -ENV APACHE_RUN_DIR=/run/apache2 \ - APACHE_LOG_DIR=/var/log/apache2 \ - APACHE_RUN_USER=www-data \ - APACHE_RUN_GROUP=www-data \ - APACHE_PID_FILE=/run/apache2/apache2.pid RUN apache2 -t EXPOSE 80 CMD [ "apache2", "-DFOREGROUND" ] diff --git a/webdav/.dockerignore b/webdav/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..80fcc286ec94242cbc68e8b265b000c2bf18f886 --- /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 0000000000000000000000000000000000000000..22c5fe7302fb3a17dffc82b9a1be47bbae1a5c55 --- /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 0000000000000000000000000000000000000000..fec881dabf1715f9363ab4e2eff583832f26a76b --- /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 0000000000000000000000000000000000000000..86bbeaf0289158440626a31ba3c12de7befd4816 --- /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 0000000000000000000000000000000000000000..79ab70e6c6df21c7be00a5df1a877afdc89dd7a6 --- /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>