From ce5c93c2ec4e39feb91f60bc4d862e37a426d928 Mon Sep 17 00:00:00 2001 From: Zimovskii Anatolii Date: Sun, 13 Nov 2022 00:59:58 +0300 Subject: [PATCH] apache2 php8.1 --- linux/ecosystem/apache2/php8.0/Dockerfile | 7 -- linux/ecosystem/apache2/php8.1/Dockerfile | 111 ++++++++++++++++++ linux/ecosystem/apache2/php8.1/Makefile | 19 +++ linux/ecosystem/apache2/php8.1/README.md | 32 +++++ .../apache2/php8.1/docker-compose.yml | 6 + .../apache2/php8.1/docker-entrypoint.sh | 18 +++ 6 files changed, 186 insertions(+), 7 deletions(-) create mode 100644 linux/ecosystem/apache2/php8.1/Dockerfile create mode 100644 linux/ecosystem/apache2/php8.1/Makefile create mode 100644 linux/ecosystem/apache2/php8.1/README.md create mode 100644 linux/ecosystem/apache2/php8.1/docker-compose.yml create mode 100755 linux/ecosystem/apache2/php8.1/docker-entrypoint.sh diff --git a/linux/ecosystem/apache2/php8.0/Dockerfile b/linux/ecosystem/apache2/php8.0/Dockerfile index 6f76767bd..353295aac 100644 --- a/linux/ecosystem/apache2/php8.0/Dockerfile +++ b/linux/ecosystem/apache2/php8.0/Dockerfile @@ -54,13 +54,6 @@ RUN apt-get update && \ ################################################################## RUN echo "TLS_REQCERT never" >> /etc/ldap/ldap.conf -################################################################## -# Installing IOnCube addon -################################################################## -#RUN echo "zend_extension = ${PHP_MODULE_PATH}/ioncube_loader_lin_7.4.so" >> ${PHP_DIR}/apache2/php.ini && \ -# php -m && \ -# php -v - ################################################################## # Installing timezonedb addon ################################################################## diff --git a/linux/ecosystem/apache2/php8.1/Dockerfile b/linux/ecosystem/apache2/php8.1/Dockerfile new file mode 100644 index 000000000..3d5c68e92 --- /dev/null +++ b/linux/ecosystem/apache2/php8.1/Dockerfile @@ -0,0 +1,111 @@ +FROM epicmorg/php:php8.1 +LABEL maintainer="EpicMorg DevTeam, developer@epicm.org" +ARG DEBIAN_FRONTEND=noninteractive + +ARG PHP_MODULE_VER=20210902 +ARG PHP_MODULE_PATH=/usr/lib/php/${PHP_MODULE_VER} +ARG PHP_VER=8.1 +ARG PHP_DIR=/etc/php/${PHP_VER} +ARG P4_PHP_INI=${PHP_DIR}/mods-available/perfroce.ini +ARG SMB_PHP_INI=${PHP_DIR}/mods-available/smbclient.ini + +################################################################## +# Installing Apache2 +################################################################## +#installing apache2 repo +RUN wget -O /etc/apt/trusted.gpg.d/apache2.gpg https://packages.sury.org/apache2/apt.gpg +RUN sh -c 'echo "deb https://packages.sury.org/apache2/ buster main" > /etc/apt/sources.list.d/apache2.list' + +#Install base packages +RUN apt-get update && \ + apt-get install -y --allow-unauthenticated \ + apache2 \ + apache2-utils \ + libapache2-mod-php8.1 \ + libapache2-mod-webauth \ + libapache2-mod-xforward \ + libapache2-mod-security2 && \ + a2enmod \ + php8.1 \ + rewrite \ + ldap \ + heartmonitor \ + auth_basic \ + authnz_ldap \ + headers \ + heartbeat \ + slotmem_shm \ + lua \ + mime \ + status \ + xml2enc \ + xforward \ + remoteip \ + filter \ + dav \ + dav_fs \ + alias && \ + ln -sf /etc/ssl/dhparam.pem /etc/apache2/dhparam.pem && \ + php -m && \ + php -v + +################################################################## +# LDAP Fix +################################################################## +RUN echo "TLS_REQCERT never" >> /etc/ldap/ldap.conf + +################################################################## +# Installing IOnCube addon +################################################################## +RUN echo "zend_extension = ${PHP_MODULE_PATH}/ioncube_loader_lin_8.1.so" >> ${PHP_DIR}/apache2/php.ini && \ + php -m && \ + php -v + +################################################################## +# Installing timezonedb addon +################################################################## +RUN echo "extension = ${PHP_MODULE_PATH}/timezonedb.so" >> ${PHP_DIR}/apache2/php.ini && \ + php -m && \ + php -v + +################################################################## +# Installing imagic addon +################################################################## +RUN echo "extension = ${PHP_MODULE_PATH}/imagick.so" >> ${PHP_DIR}/apache2/php.ini && \ + php -m && \ + php -v + +################################################################## +# Installing smbclient addon +################################################################## +RUN ln -sf ${SMB_PHP_INI} ${PHP_DIR}/apache2/conf.d/smbclient.ini && \ + php -m && \ + php -v + +################################################################## +# cleaninig up +################################################################## +RUN apt clean -y && \ + apt autoclean -y && \ + rm -rfv /var/lib/apt/lists/* && \ + rm -rfv /var/cache/apt/archives/*.deb && \ + rm -rfv /tmp/deb/* && \ + rm -rfv /tmp/ioncube/* && \ + rm -rfv /tmp/composer-setup.php && \ + rm -rfv /tmp/ioncube.tar.gz + +#healthcheck. good practice +HEALTHCHECK --interval=2m --timeout=3s CMD curl -f http://localhost:80/ || exit 1 + +# Add image configuration and scripts +COPY docker-entrypoint.sh /usr/bin/docker-entrypoint.sh +RUN chmod 755 /usr/bin/docker-entrypoint.sh +RUN chown -Rf www-data:www-data /var/www + +#Final config +VOLUME ["/var/www"] +WORKDIR /var/www/ +EXPOSE 80 443 + +ENTRYPOINT ["tini", "-s", "--", "docker-entrypoint.sh"] +CMD ["docker-entrypoint.sh"] diff --git a/linux/ecosystem/apache2/php8.1/Makefile b/linux/ecosystem/apache2/php8.1/Makefile new file mode 100644 index 000000000..9ef622aa9 --- /dev/null +++ b/linux/ecosystem/apache2/php8.1/Makefile @@ -0,0 +1,19 @@ +all: app + +app: + make build + make deploy + make clean + +build: + docker-compose build --compress --parallel --progress plain + +deploy: + docker-compose push + +clean: + docker container prune -f + docker image prune -f + docker network prune -f + docker volume prune -f + docker system prune -af diff --git a/linux/ecosystem/apache2/php8.1/README.md b/linux/ecosystem/apache2/php8.1/README.md new file mode 100644 index 000000000..86a34d4b1 --- /dev/null +++ b/linux/ecosystem/apache2/php8.1/README.md @@ -0,0 +1,32 @@ +# Compose example + +```yml +version: '3.7' +services: + websites: + image: epicmorg/websites +# depends_on: +# - mysql +# - memcached + restart: unless-stopped + volumes: + - /etc/localtime:/etc/localtime + - /etc/timezone:/etc/timezone +# - /etc/letsencrypt:/etc/letsencrypt + - www:/var/www + - apache2:/etc/apache2 + - php:/etc/php + restart: unless-stopped +# extra_hosts: +# - "example.com:192.168.0.11" + tmpfs: + - /tmp + - /var/lib/php/sessions +volumes: + www: + external: true + apache2: + external: true + php: + external: true +``` diff --git a/linux/ecosystem/apache2/php8.1/docker-compose.yml b/linux/ecosystem/apache2/php8.1/docker-compose.yml new file mode 100644 index 000000000..d55e093ff --- /dev/null +++ b/linux/ecosystem/apache2/php8.1/docker-compose.yml @@ -0,0 +1,6 @@ +version: '3.9' +services: + app: + image: "epicmorg/apache2:php8.1" + build: + context: . diff --git a/linux/ecosystem/apache2/php8.1/docker-entrypoint.sh b/linux/ecosystem/apache2/php8.1/docker-entrypoint.sh new file mode 100755 index 000000000..b421b8648 --- /dev/null +++ b/linux/ecosystem/apache2/php8.1/docker-entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [[ -z "${FIX_WWW_DATA}" ]]; then + echo "[apache2] env FIX_WWW_DATA is not set. Skipping..." +elif [ "${FIX_WWW_DATA}" == "false" ]; then + echo "[apache2] env FIX_WWW_DATA is set to false. Skipping..." +elif [ "${FIX_WWW_DATA}" == "true" ]; then + echo "[apache2] Changing permissions for /var/www path. Dont worry, please wait." + chown www-data:www-data /var/www -R + echo "[apache2] Done" +else + echo "[apache2] env FIX_WWW_DATA is set to strange value. Skipping..." +fi + +echo "[apache2] Starting up" +source /etc/apache2/envvars +tail -F /var/log/apache2/* & +exec apache2 -D FOREGROUND