php-apache/Dockerfile
2024-08-26 22:07:22 +02:00

69 lines
4.1 KiB
Docker

# Rx3 PHP Apache Mageia-9 Docker Image
#-------------------------------------------------------------------------------
ARG IMG_URL_PREFIX="rx3"
FROM ${IMG_URL_PREFIX}/server-mga9:1.1.0
ARG IMG_ID
ARG IMG_NAME
ARG IMG_VERSION
ARG IMG_MAINTAINER
LABEL org.rx3.${IMG_ID}.name=${IMG_NAME}
LABEL org.rx3.${IMG_ID}.version=${IMG_VERSION}
LABEL org.rx3.${IMG_ID}.maintainer=${IMG_MAINTAINER}
LABEL maintainer=${IMG_MAINTAINER}
#---------------------------------------------------------------------------------------------------
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\
?>'
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
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\
sed -i -e "s%/var/www/html%${APACHE_DOC_ROOT}%" /etc/httpd/conf/httpd.conf'
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
ARG HTTPD_INI='[program:httpd] \n\
command=/usr/sbin/httpd -DFOREGROUND'
#---------------------------------------------------------------------------------------------------
RUN urpmi --force apache apache-mod_php php-cli php-pgsql php-mysqli php-pdo_pgsql php-pdo_mysql php-phpmailer \
&& echo -e "${HTTPD_CONF}" | sed -e 's/ *$//' > /etc/httpd/conf/conf.d/rx3.conf \
&& echo -e "${INFO_PHP}" | sed -e 's/ *$//' > /var/www/html/info.php \
&& echo -e "${HTTPD}" | sed -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 "#!/bin/bash\n\necho 'hello world!' >/tmp/toto\necho 'Test init completed.'" > /etc/init.d/test \
&& chmod a+x /etc/init.d/test \
&& ln -s /etc/init.d/test /etc/rcD.d/S20test \
&& echo -e "${HTTPD_INI}" | sed -e 's/ *$//' > /etc/supervisord.d/httpd.ini
VOLUME /var/www/html
EXPOSE 80