- Now use rx3/server-mga9:1.1.0 image,

- supervisor & logrotate configured.
This commit is contained in:
Arnaud G. GIBERT 2024-08-26 22:02:50 +02:00
parent 1d1674ebac
commit 54ccdf959e
5 changed files with 92 additions and 15 deletions

27
.env
View File

@ -1,9 +1,32 @@
# Rx3 PHP Apache Mageia-9 Docker Image
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Global Settings
#-------------------------------------------------------------------------------
IMG_ORG="rx3"
IMG_REGISTRY="docker.xor.rx3:5000"
IMG_URL_PREFIX="${IMG_REGISTRY}/${IMG_ORG}"
#-------------------------------------------------------------------------------
# Image Settings
#-------------------------------------------------------------------------------
IMG_ID="php-apache-mga9" IMG_ID="php-apache-mga9"
IMG_NAME="Rx3 PHP Apache Mageia-9 Docker Image" IMG_NAME="Rx3 PHP Apache Mageia-9 Docker Image"
IMG_VERSION="1.2.0" IMG_VERSION="1.3.0"
IMG_URL="${IMG_URL_PREFIX}/${IMG_ID}:${IMG_VERSION}"
IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>' IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
# To be configured
#-------------------------------------------------------------------------------
# User Settings
#-------------------------------------------------------------------------------
APACHE_UID=980 APACHE_UID=980
APACHE_GID=977 APACHE_GID=977
APACHE_DOC_ROOT=/var/www/html APACHE_DOC_ROOT=/var/www/html

View File

@ -1,7 +1,9 @@
# Rx3 PHP Apache Mageia-9 Docker Image # Rx3 PHP Apache Mageia-9 Docker Image
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
FROM docker.xor.rx3:5000/rx3/base-mga9:1.2.1 ARG IMG_URL_PREFIX="rx3"
FROM ${IMG_URL_PREFIX}/server-mga9:1.1.0
ARG IMG_ID ARG IMG_ID
ARG IMG_NAME ARG IMG_NAME
@ -14,14 +16,53 @@ LABEL org.rx3.${IMG_ID}.maintainer=${IMG_MAINTAINER}
LABEL 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 \ RUN urpmi --force apache apache-mod_php php-cli php-pgsql php-mysqli php-pdo_pgsql php-pdo_mysql php-phpmailer \
&& echo -e "RewriteEngine On\n<Directory /var/www/html>\n Options Includes Indexes FollowSymLinks\n AllowOverride All\n Require all granted\n</Directory>" >/etc/httpd/conf/conf.d/rx3.conf \ && echo -e "${HTTPD_CONF}" | sed -e 's/ *$//' > /etc/httpd/conf/conf.d/rx3.conf \
&& echo -e "<?php\n phpinfo();\n phpinfo(INFO_MODULES);\n?>\n" >/var/www/html/info.php \ && echo -e "${INFO_PHP}" | sed -e 's/ *$//' > /var/www/html/info.php \
&& echo -e '#!/bin/bash\n\nusermod -u ${APACHE_UID} apache\ngroupmod -g ${APACHE_GID} apache\n\nchown -R apache:apache /var/log/httpd\n\nsed -i -e "s%/var/www/html%${APACHE_DOC_ROOT}%" /etc/httpd/conf/httpd.conf\n\n/usr/sbin/httpd -DFOREGROUND' > /usr/local/sbin/apache_init \ && echo -e "${HTTPD}" | sed -e 's/ *$//' > /etc/init.d/httpd \
&& chmod a+x /usr/local/sbin/apache_init && 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 VOLUME /var/www/html
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["/usr/local/sbin/apache_init"]

View File

@ -1,13 +1,14 @@
Welcome to php-apache-mga9 docker image! Welcome to Rx3/PHP-Apache-Mga9 docker image!
This is project aims to build a PHP + Apache + Mageia 9 docker image used by others Rx3 packaging projects. This is project aims to build a PHP + Apache + Mageia 9 docker image used by others Rx3 packaging projects.
Features: Features:
- Curtently based on base-mga9:1.2.1 image, - Curtently based on rx3/server-mga9:1.1.0 image,
- PostgreSQL & MySQL ready, - PostgreSQL & MySQL ready,
- PHPMailer installed, - PHPMailer installed,
- logrotate configured,
- Apache UID, GID & document root directory configurable. - Apache UID, GID & document root directory configurable.

View File

@ -1,5 +1,14 @@
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
PHP-Apache-Mga9 V 1.2.0 - A. GIBERT - 2024/08/24 Rx3/PHP-Apache-Mga9 V 1.3.0 - A. GIBERT - 2024/08/26
------------------------------------------------------------------------------------------------------------------------------------
- Now use rx3/server-mga9:1.1.0 image,
- supervisor & logrotate configured.
------------------------------------------------------------------------------------------------------------------------------------
Rx3/PHP-Apache-Mga9 V 1.2.0 - A. GIBERT - 2024/08/24
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
- Add and use APACHE_DOC_ROOT environment variable, - Add and use APACHE_DOC_ROOT environment variable,
@ -9,7 +18,7 @@ PHP-Apache-Mga9 V 1.2.0 - A. GIBERT - 2024/08/24
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
PHP-Apache-Mga9 V 1.1.0 - A. GIBERT - 2024/08/24 Rx3/PHP-Apache-Mga9 V 1.1.0 - A. GIBERT - 2024/08/24
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
- Add PHP PDO PostgreSQL & MySQL modules, - Add PHP PDO PostgreSQL & MySQL modules,
@ -18,7 +27,7 @@ PHP-Apache-Mga9 V 1.1.0 - A. GIBERT - 2024/08/24
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
PHP-Apache-Mga9 V 1.0.0 - A. GIBERT - 2024/08/22 Rx3/PHP-Apache-Mga9 V 1.0.0 - A. GIBERT - 2024/08/22
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
- Initial release, - Initial release,

View File

@ -7,7 +7,8 @@ services:
webapp: webapp:
container_name: ${IMG_ID} container_name: ${IMG_ID}
image: docker.xor.rx3:5000/rx3/${IMG_ID}:${IMG_VERSION}
image: ${IMG_URL}
build: build:
context: . context: .
@ -16,6 +17,7 @@ services:
- IMG_NAME=${IMG_NAME} - IMG_NAME=${IMG_NAME}
- IMG_VERSION=${IMG_VERSION} - IMG_VERSION=${IMG_VERSION}
- IMG_MAINTAINER=${IMG_MAINTAINER} - IMG_MAINTAINER=${IMG_MAINTAINER}
- IMG_URL_PREFIX=${IMG_URL_PREFIX}
restart: unless-stopped restart: unless-stopped
@ -27,4 +29,5 @@ services:
network_mode: bridge network_mode: bridge
ports: ports:
- "127.0.0.1:9010:9001"
- "127.0.0.1:8080:80" - "127.0.0.1:8080:80"