php-apache/Dockerfile

80 lines
4.9 KiB
Docker
Raw Permalink Normal View History

# Rx3-Docker/PHP-Apache Docker Image
2024-08-22 14:26:42 +02:00
#-------------------------------------------------------------------------------
ARG IMG_FROM_URL="rx3-docker/server:latest"
FROM ${IMG_FROM_URL}
2024-08-22 14:26:42 +02:00
ARG IMG_NAME
ARG IMG_NAME_FULL
2024-08-22 14:26:42 +02:00
ARG IMG_VERSION
ARG IMG_MAINTAINER
LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL}
LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION}
LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER}
2024-08-22 14:26:42 +02:00
LABEL maintainer=${IMG_MAINTAINER}
ARG APACHE_DOC_ROOT
ARG APACHE_LOG_DIR
ARG APACHE_PORT
2024-08-22 14:26:42 +02:00
#---------------------------------------------------------------------------------------------------
ARG HTTPD='#!/bin/bash \n\
\n\
usermod -u ${APACHE_UID} apache \n\
groupmod -g ${APACHE_GID} apache \n\
\n\
chown -R apache:apache /var/log/httpd \n\
\n\
for file in /etc/httpd/conf/httpd.conf /etc/httpd/conf/conf.d/rx3.conf \n\
do \n\
sed -i -e "s%/var/www/html%${APACHE_DOC_ROOT}%" ${file} \n\
done \n\
\n\
chgrp apache /usr/bin/pwauth \n\
chmod u+s /usr/bin/pwauth'
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
ARG HTTPD_INI='[program:httpd] \n\
command=/usr/sbin/httpd -DFOREGROUND'
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
ARG HTTPD_CONF='RewriteEngine On \n\
<Directory /var/www/html> \n\
Options Includes Indexes FollowSymLinks \n\
AllowOverride All \n\
Require all granted \n\
</Directory>'
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
ARG INFO_PHP='<?php \n\
phpinfo(); \n\
phpinfo( INFO_MODULES); \n\
?>'
#---------------------------------------------------------------------------------------------------
RUN urpmi --force apache apache-mod_proxy apache-mod_proxy_html apache-mod_php php-cli php-pgsql php-mysqli php-pdo_pgsql php-pdo_mysql php-phpmailer pwauth \
&& echo -e "${HTTPD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/httpd \
&& chmod a+x /etc/init.d/httpd \
&& ln -s /etc/init.d/httpd /etc/rcD.d/S30httpd \
&& echo -e "${HTTPD_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/httpd.ini \
&& echo -e "${HTTPD_CONF}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/httpd/conf/conf.d/rx3.conf \
&& echo -e "${INFO_PHP}" | sed -e "s/\`/'/g" -e 's/ *$//' > /var/www/html/info.php \
&& sed -i -e "s/memory_limit = 128M/memory_limit = 512M/" /etc/php.d/01_ressourcelimits.ini \
&& sed -i -e "s/upload_max_filesize = 16M/upload_max_filesize = 32M/" /etc/php.d/01_fileuploads.ini \
&& sed -i -e "s/post_max_size = 8M/post_max_size = 32M/" /etc/php.d/01_datahandling.ini
2024-08-22 14:26:42 +02:00
VOLUME ${APACHE_DOC_ROOT}
VOLUME ${APACHE_LOG_DIR}
2024-08-22 14:26:42 +02:00
EXPOSE ${APACHE_PORT}