From 2de04605366ba437b5539c4b3b9503fb02c18e7d Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+github@gmail.com>
Date: Thu, 1 Feb 2024 15:20:24 +0100
Subject: [PATCH] add php 7.2 and 7.3 as options

---
 config/nginx-sites.conf | 24 ++++++++++++++--------
 config/nginx.conf       | 26 ++++++++++++++++++++++++
 docker-compose.yml      | 10 +++++++++
 generate.sh             |  1 +
 php/7.2-Dockerfile      | 45 +++++++++++++++++++++++++++++++++++++++++
 php/7.3-Dockerfile      | 45 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 143 insertions(+), 8 deletions(-)
 create mode 100755 generate.sh
 create mode 100644 php/7.2-Dockerfile
 create mode 100644 php/7.3-Dockerfile

diff --git a/config/nginx-sites.conf b/config/nginx-sites.conf
index cba805b..63eea63 100644
--- a/config/nginx-sites.conf
+++ b/config/nginx-sites.conf
@@ -10,14 +10,6 @@ location ^~ /trunk {
     include nginx-php.conf;
 }
 
-location ^~ /uol-5.1 {
-    alias /var/www/html/studip/uol/5.1/public;
-    index index.php index.html index.html;
-
-    set $site_document_root /var/www/html/studip/uol/5.1/public;
-    include nginx-php.conf;
-}
-
 location ^~ /5.0 {
     alias /var/www/html/studip/5.0/public;
     index index.php index.html index.html;
@@ -61,3 +53,19 @@ location ^~ /uol-5.4 {
     set $site_document_root /var/www/html/studip/uol/5.4/public;
     include nginx-php.conf;
 }
+
+location ^~ /uol-5.1 {
+    alias /var/www/html/studip/uol/5.1/public;
+    index index.php index.html index.html;
+
+    set $site_document_root /var/www/html/studip/uol/5.1/public;
+    include nginx-php.conf;
+}
+
+location ^~ /peoe-4.6 {
+    alias /var/www/html/studip/uol/peoe-4.6/public;
+    index index.php index.html index.html;
+
+    set $site_document_root /var/www/html/studip/uol/peoe-4.6/public;
+    include nginx-php.conf;
+}
diff --git a/config/nginx.conf b/config/nginx.conf
index 0dfa6ff..d91e17a 100644
--- a/config/nginx.conf
+++ b/config/nginx.conf
@@ -13,6 +13,12 @@ upstream php82_backend {
 upstream php83_backend {
    server php83:9000;
 }
+upstream php72_backend {
+   server php72:9000;
+}
+upstream php73_backend {
+   server php73:9000;
+}
 
 server {
     listen 80 default_server;
@@ -63,3 +69,23 @@ server {
 
     include sites.conf;
 }
+
+server {
+    listen 88 default_server;
+    server_name _;
+    root /var/www/html;
+
+    set $fastcgi_backend php72_backend;
+
+    include sites.conf;
+}
+
+server {
+    listen 89 default_server;
+    server_name _;
+    root /var/www/html;
+
+    set $fastcgi_backend php73_backend;
+
+    include sites.conf;
+}
diff --git a/docker-compose.yml b/docker-compose.yml
index 99f042f..fbc1a19 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -9,6 +9,8 @@ services:
       - "8081:82"
       - "8082:83"
       - "8083:84"
+      - "8072:88"
+      - "8073:89"
     networks:
       - code-network
     volumes:
@@ -48,6 +50,14 @@ services:
     <<: *base-php
     build:
       dockerfile: php/8.3-Dockerfile
+  php72:
+    <<: *base-php
+    build:
+      dockerfile: php/7.2-Dockerfile
+  php73:
+    <<: *base-php
+    build:
+      dockerfile: php/7.3-Dockerfile
 
 networks:
   code-network:
diff --git a/generate.sh b/generate.sh
new file mode 100755
index 0000000..20da5cb
--- /dev/null
+++ b/generate.sh
@@ -0,0 +1 @@
+docker compose up --build
diff --git a/php/7.2-Dockerfile b/php/7.2-Dockerfile
new file mode 100644
index 0000000..b431084
--- /dev/null
+++ b/php/7.2-Dockerfile
@@ -0,0 +1,45 @@
+FROM php:7.2-fpm
+
+# Install system requirements
+RUN apt update && apt install -y --no-install-recommends \
+        default-mysql-client \
+        default-libmysqlclient-dev \
+        libcurl4-openssl-dev zlib1g-dev \
+        libjpeg-dev \
+        libpng-dev \
+        libpq-dev \
+        libwebp-dev \
+        libonig-dev \
+        libzip-dev \
+        libicu-dev \
+        libfreetype6-dev \
+        vim \
+    && rm -rf /var/lib/apt/lists/*
+
+# Install php extensions
+RUN docker-php-ext-configure gd --with-jpeg-dir --with-freetype-dir --with-webp-dir
+RUN docker-php-ext-install -j$(nproc) gettext curl gd mbstring zip pdo pdo_mysql pdo_pgsql mysqli intl json
+
+# Install php-soap
+RUN apt update \
+    && apt install -y libxml2-dev \
+    && rm -rf /var/lib/apt/lists/*
+RUN docker-php-ext-install soap
+
+# Install de_DE locale
+RUN apt update \
+    && apt install -y --no-install-recommends locales \
+    && locale-gen de_DE \
+    && update-locale \
+    && rm -rf /var/lib/apt/lists/*
+
+# Install Memcached
+RUN apt update \
+    && apt install -y git libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \
+    && rm -rf /var/lib/apt/lists/* \
+    && pecl install memcached \
+    && docker-php-ext-enable memcached
+
+# Install redis
+RUN pecl install redis \
+    && docker-php-ext-enable redis
diff --git a/php/7.3-Dockerfile b/php/7.3-Dockerfile
new file mode 100644
index 0000000..16d257e
--- /dev/null
+++ b/php/7.3-Dockerfile
@@ -0,0 +1,45 @@
+FROM php:7.3-fpm
+
+# Install system requirements
+RUN apt update && apt install -y --no-install-recommends \
+        default-mysql-client \
+        default-libmysqlclient-dev \
+        libcurl4-openssl-dev zlib1g-dev \
+        libjpeg-dev \
+        libpng-dev \
+        libpq-dev \
+        libwebp-dev \
+        libonig-dev \
+        libzip-dev \
+        libicu-dev \
+        libfreetype6-dev \
+        vim \
+    && rm -rf /var/lib/apt/lists/*
+
+# Install php extensions
+RUN docker-php-ext-configure gd --with-jpeg-dir --with-freetype-dir --with-webp-dir
+RUN docker-php-ext-install -j$(nproc) gettext curl gd mbstring zip pdo pdo_mysql pdo_pgsql mysqli intl json
+
+# Install php-soap
+RUN apt update \
+    && apt install -y libxml2-dev \
+    && rm -rf /var/lib/apt/lists/*
+RUN docker-php-ext-install soap
+
+# Install de_DE locale
+RUN apt update \
+    && apt install -y --no-install-recommends locales \
+    && locale-gen de_DE \
+    && update-locale \
+    && rm -rf /var/lib/apt/lists/*
+
+# Install Memcached
+RUN apt update \
+    && apt install -y git libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \
+    && rm -rf /var/lib/apt/lists/* \
+    && pecl install memcached \
+    && docker-php-ext-enable memcached
+
+# Install redis
+RUN pecl install redis \
+    && docker-php-ext-enable redis
-- 
GitLab