From 6e0fa13594d8b0727f62e9cbbdc40c751b7da034 Mon Sep 17 00:00:00 2001 From: "Arnaud G. GIBERT" Date: Mon, 26 Aug 2024 22:02:50 +0200 Subject: [PATCH] - Now use rx3/server-mga9:1.1.0 image, - supervisor & logrotate configures. --- .env | 27 ++++++++++++++++++++++-- Dockerfile | 55 ++++++++++++++++++++++++++++++++++++++++++------ ReadMe.txt | 5 +++-- ReleaseNotes.txt | 15 ++++++++++--- compose.yaml | 5 ++++- 5 files changed, 92 insertions(+), 15 deletions(-) diff --git a/.env b/.env index 88c19fa..84e0617 100644 --- a/.env +++ b/.env @@ -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_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" ' -# To be configured + + +#------------------------------------------------------------------------------- +# User Settings +#------------------------------------------------------------------------------- + APACHE_UID=980 APACHE_GID=977 APACHE_DOC_ROOT=/var/www/html diff --git a/Dockerfile b/Dockerfile index e34da2f..7082029 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ # 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_NAME @@ -14,14 +16,53 @@ LABEL org.rx3.${IMG_ID}.maintainer=${IMG_MAINTAINER} LABEL maintainer=${IMG_MAINTAINER} + +#--------------------------------------------------------------------------------------------------- +ARG HTTPD_CONF='RewriteEngine On \n\ + \n\ + Options Includes Indexes FollowSymLinks \n\ + AllowOverride All \n\ + Require all granted \n\ +' +#--------------------------------------------------------------------------------------------------- + +#--------------------------------------------------------------------------------------------------- +ARG INFO_PHP='' +#--------------------------------------------------------------------------------------------------- + +#--------------------------------------------------------------------------------------------------- +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 "RewriteEngine On\n\n Options Includes Indexes FollowSymLinks\n AllowOverride All\n Require all granted\n" >/etc/httpd/conf/conf.d/rx3.conf \ - && echo -e "\n" >/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 \ - && chmod a+x /usr/local/sbin/apache_init + && 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 - -ENTRYPOINT ["/usr/local/sbin/apache_init"] diff --git a/ReadMe.txt b/ReadMe.txt index 73247fd..cd8645a 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -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. Features: - - Curtently based on base-mga9:1.2.1 image, + - Curtently based on rx3/server-mga9:1.1.0 image, - PostgreSQL & MySQL ready, - PHPMailer installed, + - logrotate configured, - Apache UID, GID & document root directory configurable. diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index aba32fe..c254892 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -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, @@ -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, @@ -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, diff --git a/compose.yaml b/compose.yaml index b93b9ce..0ec624c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -7,7 +7,8 @@ services: webapp: container_name: ${IMG_ID} - image: docker.xor.rx3:5000/rx3/${IMG_ID}:${IMG_VERSION} + + image: ${IMG_URL} build: context: . @@ -16,6 +17,7 @@ services: - IMG_NAME=${IMG_NAME} - IMG_VERSION=${IMG_VERSION} - IMG_MAINTAINER=${IMG_MAINTAINER} + - IMG_URL_PREFIX=${IMG_URL_PREFIX} restart: unless-stopped @@ -27,4 +29,5 @@ services: network_mode: bridge ports: + - "127.0.0.1:9010:9001" - "127.0.0.1:8080:80"