phpapache-arm64/Dockerfile
2018-05-18 12:08:29 -04:00

49 lines
2.2 KiB
Docker

FROM "php:7.1-apache"
MAINTAINER "Julien Cabillot <dockerimages@cabillot.eu>"
RUN export DEBIAN_FRONTEND="noninteractive" && \
sed -i'' 's/ServerSignature On/ServerSignature Off/; s/ServerTokens OS/ServerTokens Prod/' "/etc/apache2/conf-enabled/security.conf" && \
sed -i'' 's/^Listen 80$/Listen 8080/' "/etc/apache2/ports.conf" && \
sed -i'' 's/^<VirtualHost \*:80>$/<VirtualHost *:8080>/' '/etc/apache2/sites-enabled/000-default.conf' && \
echo "RemoteIPHeader X-Forwarded-For\nRemoteIPProxiesHeader X-Forwarded-By" > "${APACHE_CONFDIR}/conf-available/remoteip.conf" && \
sed -i'' 's/\(LogFormat "%h.*combined\)/LogFormat "%a %l %u %t \\"%r\\" %>s %O \\"%{Referer}i\\" \\"%{User-Agent}i\\"" combined/' "${APACHE_CONFDIR}/apache2.conf" && \
a2enconf remoteip && \
a2enmod remoteip headers rewrite && \
apt-get -qq --yes autoremove --purge && \
apt-get -qq --yes clean all && \
rm -rf "/usr/share/doc/"* \
"/var/cache/"* \
"/var/lib/apt/lists/"* \
"/usr/src/"* \
"/var/cache/"* \
"/var/log/"{apt/*,dpkg.log} \
"/var/www/html" \
"/tmp/"* && \
install --directory --group="www-data" --owner="www-data" --mode="2770" "/var/www/html" && \
# On active les logs sur stderr (apache + php)
sed -ri 's#^(\s*ErrorLog)\s+\S+#\1 /proc/self/fd/2#g;' "/etc/apache2/apache2.conf" && \
sed -ri ' \
s#^(\s*CustomLog)\s+\S+#\1 /proc/self/fd/1#g; \
s#^(\s*ErrorLog)\s+\S+#\1 /proc/self/fd/2#g; \
' "/etc/apache2/sites-enabled/000-default.conf" && \
echo "error_reporting=E_ALL\nerror_log=/proc/self/fd/2\nlog_errors=On\nexpose_php=Off" > "/usr/local/etc/php/conf.d/override.ini"
# Add Tini
ENV "TINI_VERSION" "v0.16.1"
ADD "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini" "/tini"
RUN chmod +x "/tini"
# TODO: actuellement tiny fout completement la merde
#ENTRYPOINT ["/tini", "--"]
CMD [ "docker-php-entrypoint", "apache2-foreground" ]
# C'est dommage mais il n'est pas possible de faire unexpose :
# https://github.com/moby/moby/issues/3465
EXPOSE "8080/tcp"
# TODO: à remettre une fois le bug corrigé
#HEALTHCHECK --interval="5s" \
# CMD curl --fail "http://localhost:8080" || exit 1