Skip to content
Snippets Groups Projects
Commit 20584f79 authored by nimrod's avatar nimrod
Browse files

Refactor the httpd images a bit.

- Use the environment variables (like APACHE_RUN_USER or APACHE_LOG_DIR)
  during the build, so now they're set earlier.
- Add the APACHE_LOCK_DIR.
parent 7b51e897
Branches
No related tags found
No related merge requests found
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" ]
......
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" ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment