docker-webdav-apache/Dockerfile

58 lines
1.9 KiB
Docker
Raw Permalink Normal View History

FROM httpd:bullseye
2023-06-25 15:38:35 +00:00
# These variables are inherited from the httpd:alpine image:
# ENV HTTPD_PREFIX /usr/local/apache2
# WORKDIR "$HTTPD_PREFIX"
# Copy in our configuration files.
COPY conf/ conf/
2023-06-25 17:13:49 +00:00
COPY docker-entrypoint.sh /docker-entrypoint.sh
2023-06-25 17:11:14 +00:00
2023-06-25 17:13:49 +00:00
RUN chmod +x /docker-entrypoint.sh; \
2023-06-25 17:11:14 +00:00
set -ex; \
2023-06-25 15:38:35 +00:00
# Create empty default DocumentRoot.
mkdir -p "/var/www/html"; \
# Create directories for Dav data and lock database.
mkdir -p "/var/lib/dav/data"; \
touch "/var/lib/dav/DavLock"; \
chown -R www-data:www-data "/var/lib/dav"; \
\
# Enable DAV modules.
for i in dav dav_fs; do \
sed -i -e "/^#LoadModule ${i}_module.*/s/^#//" "conf/httpd.conf"; \
done; \
\
# Make sure authentication modules are enabled.
for i in authn_core authn_file authz_core authz_user auth_basic auth_digest; do \
sed -i -e "/^#LoadModule ${i}_module.*/s/^#//" "conf/httpd.conf"; \
done; \
\
# Make sure other modules are enabled.
for i in alias headers mime setenvif; do \
sed -i -e "/^#LoadModule ${i}_module.*/s/^#//" "conf/httpd.conf"; \
done; \
\
# Run httpd as "www-data" (instead of "daemon").
for i in User Group; do \
sed -i -e "s|^$i .*|$i www-data|" "conf/httpd.conf"; \
done; \
\
# Include enabled configs and sites.
printf '%s\n' "Include conf/conf-enabled/*.conf" \
>> "conf/httpd.conf"; \
printf '%s\n' "Include conf/sites-enabled/*.conf" \
>> "conf/httpd.conf"; \
\
# Enable dav and default site.
mkdir -p "conf/conf-enabled"; \
mkdir -p "conf/sites-enabled"; \
ln -s ../conf-available/dav.conf "conf/conf-enabled"; \
ln -s ../sites-available/default.conf "conf/sites-enabled"; \
# Install openssl if we need to generate a self-signed certificate.
2023-06-25 17:31:13 +00:00
apt update -y && apt upgrade -y && apt install openssl libapr1 libaprutil1 -y
2023-06-25 15:38:35 +00:00
EXPOSE 80/tcp 443/tcp
2023-06-25 17:13:49 +00:00
ENTRYPOINT [ "/docker-entrypoint.sh" ]
2023-06-25 15:38:35 +00:00
CMD [ "httpd-foreground" ]