summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--2.4/Dockerfile63
-rw-r--r--2.4/conf/conf-available/pid.conf1
-rwxr-xr-x2.4/docker-entrypoint.sh2
3 files changed, 36 insertions, 30 deletions
diff --git a/2.4/Dockerfile b/2.4/Dockerfile
index 52e7104..87a63d4 100644
--- a/2.4/Dockerfile
+++ b/2.4/Dockerfile
@@ -1,13 +1,26 @@
FROM httpd:alpine
+ARG ENABLE_PROXY=0
+ARG ENABLE_DAV=0
+ARG ENABLE_PHP5=0
+
+ARG EXTRA_PACKAGES=""
+ARG EXTRA_MODULES=""
+
# These variables are inherited from the httpd:alpine image:
# ENV HTTPD_PREFIX /usr/local/apache2
# WORKDIR "$HTTPD_PREFIX"
+COPY conf/ conf/
+COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
+
RUN set -ex; \
# Install openssl if we need to generate a self-signed certificate.
- apk add --no-cache openssl; \
- apk add --no-cache apr-util-dbm_db; \
+ packages="${EXTRA_PACKAGES} openssl apr-util-dbm_db"; \
+ if [ ${ENABLE_PHP5} -ne 0 ]; then \
+ packages="$packages php5-apache2"; \
+ fi; \
+ apk add --no-cache $packages; \
# Create empty default DocumentRoot.
mkdir -p "/var/www/html"; \
# Create directories for Dav data and lock database.
@@ -17,44 +30,38 @@ RUN set -ex; \
sed -i -e "s|Listen .*|Listen 8080|" "conf/httpd.conf"; \
# Configure file paths
sed -i -e "s|PidFile .*|PidFile /tmp/apache.pid|" "conf/extra/httpd-mpm.conf"; \
- # 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 \
+ modules="${EXTRA_MODULES} authn_core authn_file authz_core authz_user auth_basic auth_digest alias headers mime setenvif"; \
+ if [ ${ENABLE_PROXY} -ne 0 ]; then \
+ modules="$modules rewrite proxy proxy_http"; \
+ fi; \
+ if [ ${ENABLE_DAV} -ne 0 ]; then \
+ modules="$modules dav dav_fs"; \
+ fi; \
+ if [ ${ENABLE_PHP5} -ne 0 ]; then \
+ modules="$modules php5"; \
+ fi; \
+ for i in $modules; 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' "PidFile /tmp/httpd.pid" \
+ >> "conf/httpd.conf"; \
printf '%s\n' "Include conf/conf-enabled/*.conf" \
>> "conf/httpd.conf"; \
printf '%s\n' "Include conf/sites-enabled/*.conf" \
- >> "conf/httpd.conf"
-
-COPY conf/ conf/
-
-RUN set -ex; \
- # Enable dav and default site.
+ >> "conf/httpd.conf"; \
+ # Enable module configuration and default site.
mkdir -p "conf/conf-enabled"; \
mkdir -p "conf/sites-enabled"; \
- ln -s ../conf-available/dav.conf "conf/conf-enabled"; \
- ln -s ../conf-available/pid.conf "conf/conf-enabled"; \
+ for i in $modules; do \
+ if [ -f ../conf-available/${i}.conf ]; then \
+ ln -s ../conf-available/${i}.conf "conf/conf-enabled"; \
+ fi; \
+ done; \
ln -s ../sites-available/default.conf "conf/sites-enabled"
-COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
-
EXPOSE 8080/tcp 8043/tcp
ENTRYPOINT [ "docker-entrypoint.sh" ]
CMD [ "httpd-foreground" ]
diff --git a/2.4/conf/conf-available/pid.conf b/2.4/conf/conf-available/pid.conf
deleted file mode 100644
index f88307b..0000000
--- a/2.4/conf/conf-available/pid.conf
+++ /dev/null
@@ -1 +0,0 @@
-PidFile "/tmp/httpd.pid"
diff --git a/2.4/docker-entrypoint.sh b/2.4/docker-entrypoint.sh
index ca3048d..cab689a 100755
--- a/2.4/docker-entrypoint.sh
+++ b/2.4/docker-entrypoint.sh
@@ -100,6 +100,6 @@ fi
# Create directories for Dav data and lock database.
[ ! -d "/var/lib/dav/data" ] && mkdir -p "/var/lib/dav/data"
-[ ! -e "/var/lib/dav/DavLock" ] && touch "/tmp/DavLock"
+[ ! -e "/tmp/DavLock" ] && touch "/tmp/DavLock"
exec "$@"