diff --git a/8/scripts/entrypoint.sh b/8/scripts/entrypoint.sh new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile.almalinux b/Dockerfile.almalinux index 6dec7db..a56dc32 100644 --- a/Dockerfile.almalinux +++ b/Dockerfile.almalinux @@ -5,12 +5,15 @@ FROM quay.io/teras/almalinux:${OS_VERSION}-minimal AS builder ARG OS_SHORT_VERSION=9 ARG PHP_VERSION=8.4 ARG COMPOSER_VERSION=2.8.9 +ARG WEB_SERVER=false ENV PHP_VERSION=${PHP_VERSION} ENV COMPOSER_VERSION=${COMPOSER_VERSION} ENV SERVER_ROOT=/app +ENV APP_ROOT=${SERVER_ROOT}/htdocs +ENV WEB_SERVER=${WEB_SERVER} -ENV COMPOSER_HOME=${SERVER_ROOT}/.composer +ENV COMPOSER_HOME=/var/lib/composer ENV COMPOSER_ALLOW_SUPERUSER=0 ENV COMPOSER_NO_INTERACTION=1 ENV COMPOSER_CACHE_DIR=${COMPOSER_HOME}/cache @@ -21,6 +24,7 @@ USER root WORKDIR ${SERVER_ROOT} ADD https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar /usr/local/bin/composer +ADD ./htdocs/index.html ${APP_ROOT}/ RUN /bin/mkdir -p ${COMPOSER_CACHE_DIR} ${COMPOSER_VENDOR_DIR} ${COMPOSER_BIN_DIR}; \ /bin/chown -R appuser:appuser ${COMPOSER_HOME}; \ @@ -34,6 +38,41 @@ RUN /bin/mkdir -p ${COMPOSER_CACHE_DIR} ${COMPOSER_VENDOR_DIR} ${COMPOSER_BIN_DI php php-cli php-common php-phar \ php-iconv php-mbstring php-json; \ /bin/chmod +rx /usr/local/bin/composer; \ + /bin/sed -i "s|#version#|${PHP_VERSION}}|" ${APP_ROOT}/index.html ; + +# Run if httpd is being installed, otherwise remove all packages related to it +RUN if [ ${WEB_SERVER} = "apache" ]; then \ + /bin/mkdir -p ${SERVER_ROOT}/cgi-bin; \ + /bin/chown -R appuser:appuser ${SERVER_ROOT}/cgi-bin; \ + /bin/chown -R appuser:appuser /etc/httpd \ + /bin/sed -i "s|ServerRoot /var/www|ServerRoot ${SERVER_ROOT}|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|User apache|User appuser|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|Group httpd|Group appuser|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|ServerAdmin root@localhost| ServerAdmin appuser@localhost|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|DocumentRoot \"/var/www\"|DocumentRoot \"${SERVER_ROOT}\"|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|DocumentRoot \"/var/www/html\"|DocumentRoot \"${APP_ROOT}\"|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|Directory \"/var/www/html\"|Directory \"${APP_ROOT}\"|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|AllowOverride None|AllowOverride All|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|ErrorLog .*|ErrorLog /dev/stderr \nTransferLog /dev/stdout|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|CustomLog .* combined|CustomLog /dev/stdout combined|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|LogLevel .*|LogLevel ${LOG_LEVEL}|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|LogLevel .*|LogLevel ${LOG_LEVEL}|" /etc/httpd/conf/httpd.conf ; \ + /bin/sed -i "s|/var/www/cgi-bin/|${SERVER_ROOT}/cgi-bin/|" /etc/httpd/conf/httpd.conf ; \ + else \ + /bin/rpm -e --nodeps $(rpm -qa | grep ^httpd) php-fpm; \ + /bin/rm -rf /etc/httpd; \ + fi + +# Run if nginx is being installed otherwise remove all packages related to it +RUN if [ ${WEB_SERVER} = "fpm-nginx" ]; then \ + /bin/microdnf -y --nodocs install nginx php-fpm; \ + else \ + /bin/rpm -e --nodeps $(rpm -qa | grep ^nginx); \ + fi + +# Remove unnecessary packages and clean up all cached files +RUN rpm -e --nodeps python-unversioned-command $(rpm -qa | grep ^python3) ; \ + rm -rf /usr/lib/python3* /usr/lib64/python3* /usr/share/doc/python3* /usr/share/man/man1/python3* ; \ /bin/microdnf clean all; \ /bin/rm -rf /var/cache/yum/*; \ /bin/rm -rf /var/lib/yum/history/*; \ @@ -54,6 +93,7 @@ ENV LANG=en_US.UTF-8 ENV PHP_VERSION=${PHP_VERSION} ENV COMPOSER_VERSION=${COMPOSER_VERSION} ENV SERVER_ROOT=/app +ENV APP_ROOT=${SERVER_ROOT}/htdocs ENV COMPOSER_HOME=${SERVER_ROOT}/.composer ENV COMPOSER_ALLOW_SUPERUSER=0 diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 5a7475e..ec7a29b 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,3 +1,7 @@ +# PHP 5.6 == 3.6 +# PHP 7.2 == 3.9 +# PHP 7.3 == 3.12 +# PHP 7.4 == 3.15 # PHP 8.0 == 3.16 # PHP 8.1 == 3.19 # PHP 8.2 == 3.21 @@ -20,7 +24,7 @@ ENV PHP_VERSION=${PHP_VERSION} ENV COMPOSER_VERSION=${COMPOSER_VERSION} ENV SERVER_ROOT=/app -ENV COMPOSER_HOME=${SERVER_ROOT}/.composer +ENV COMPOSER_HOME=/var/lib/composer ENV COMPOSER_ALLOW_SUPERUSER=0 ENV COMPOSER_NO_INTERACTION=1 ENV COMPOSER_CACHE_DIR=${COMPOSER_HOME}/cache diff --git a/htdocs/index.html b/htdocs/index.html index 6be1521..13b94d1 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -12,15 +12,15 @@
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to httpd.apache.org.
-For online documentation specific to the sindigilive/php:#version#-apache-#flavor#-#os# variant,
-please refer to sindigilive/php.
For online documentation specific to the teras/php:#version#-apache variant,
+please refer to teras/php.
Thank you for using httpd.