From ed5d6918b14780aa773325f977068fe746feba29 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Nov 2025 20:54:14 +0000 Subject: [PATCH 1/3] Add beautiful index.html landing page to web server variants This commit introduces a comprehensive, modern HTML landing page that showcases the features and configuration options of the ByJG PHP Docker images. Changes: - Created assets/index.html with responsive design featuring: - Overview of key features (lightweight, 45+ extensions, multi-architecture) - Complete list of pre-installed PHP extensions - Documentation of all environment variables with usage examples - Quick start examples for common scenarios - Link to phpinfo() page for detailed PHP configuration - Links to full documentation and GitHub repository - Updated generator/__init__.py to copy index.html in build process: - build_fpm_apache(): Copy index.html to Apache web root - build_fpm_nginx(): Copy index.html to Nginx web root - build_nginx(): Copy index.html to Nginx web root - Modified templates to place index.html in correct web root: - php-fpm-apache.j2: /var/www/localhost/htdocs/ - php-fpm-nginx.j2: /var/www/html/ - php-nginx.j2: /var/www/html/ The landing page provides users with immediate access to documentation and configuration guidance when they first run their containers. --- assets/index.html | 474 ++++++++++++++++++++++++++++++++++++ generator/__init__.py | 3 + templates/php-fpm-apache.j2 | 1 + templates/php-fpm-nginx.j2 | 1 + templates/php-nginx.j2 | 1 + 5 files changed, 480 insertions(+) create mode 100644 assets/index.html diff --git a/assets/index.html b/assets/index.html new file mode 100644 index 0000000..f8430bf --- /dev/null +++ b/assets/index.html @@ -0,0 +1,474 @@ + + + + + + ByJG PHP Docker Image + + + +
+
+

ðŸģ ByJG PHP Docker Image

+

Lightweight, Production-Ready PHP Containers

+
+ Alpine Linux + 45+ Extensions + Multi-Architecture +
+
+ +
+
+

âœĻ Key Features

+
+
+

ðŸŠķ Lightweight

+

Based on Alpine Linux with optimized image sizes ranging from 135-154MB uncompressed.

+
+
+

🚀 Production Ready

+

Optimized for both development and production environments with security best practices.

+
+
+

🔧 45+ Extensions

+

Pre-installed with all essential PHP extensions including database drivers, image processing, and caching.

+
+
+

ðŸŽŊ Multiple Variants

+

Choose from base, CLI, FPM, FPM-Nginx, or FPM-Apache configurations.

+
+
+

🌍 Multi-Architecture

+

Native support for amd64 (x86_64) and arm64 (Raspberry Pi, AWS Graviton).

+
+
+

🛠ïļ Developer Tools

+

CLI images include Composer, PHPUnit, PHP_CodeSniffer, and PHPMD.

+
+
+
+ +
+

ðŸ“Ķ Pre-installed PHP Extensions

+

All images come with 45+ PHP extensions ready to use:

+
+
bcmath
+
ctype
+
curl
+
dba
+
dom
+
exif
+
fileinfo
+
filter
+
ftp
+
gd
+
gettext
+
iconv
+
igbinary
+
imagick
+
intl
+
json
+
mbstring
+
mcrypt
+
memcached
+
mongodb
+
mysqli
+
mysqlnd
+
opcache
+
openssl
+
pcntl
+
pdo
+
pdo_dblib
+
pdo_mysql
+
pdo_pgsql
+
pdo_sqlite
+
phar
+
posix
+
redis
+
session
+
shmop
+
simplexml
+
soap
+
sockets
+
sqlite3
+
tokenizer
+
xdebug
+
xml
+
xmlreader
+
xmlwriter
+
xsl
+
yaml
+
zip
+
zlib
+
+
+ +
+

🔧 Environment Variables Configuration

+

Configure your container without modifying configuration files:

+ +
+

PHP_CONTROLLER

+

Description: Enable single-file controller pattern. All requests route to the specified PHP file.

+

Default: Not set

+

Use Case: Perfect for Symfony, Laravel, Slim frameworks

+ docker run -e PHP_CONTROLLER=/index.php byjg/php:8.3-fpm-nginx +
+ +
+

NGINX_ROOT

+

Description: Set the web server document root

+

Default: /var/www/html

+ docker run -e NGINX_ROOT=/srv/public byjg/php:8.3-fpm-nginx +
+ +
+

NGINX_SSL_CERT & NGINX_SSL_CERT_KEY

+

Description: Enable HTTPS by providing paths to SSL certificate and key files

+

Default: Not set (HTTP only)

+ docker run -v /etc/ssl:/etc/ssl \ + -e NGINX_SSL_CERT=/etc/ssl/my.cert \ + -e NGINX_SSL_CERT_KEY=/etc/ssl/my.key \ + byjg/php:8.3-fpm-nginx +
+ +
+

PHP_FPM_SERVER

+

Description: Configure the FastCGI server address for PHP-FPM

+

Default: 127.0.0.1:9000

+ docker run -e PHP_FPM_SERVER=127.0.0.1:9000 byjg/php:8.3-fpm-nginx +
+ +
+

DISABLEMODULE_[name]

+

Description: Disable specific PHP modules at runtime to optimize performance

+

Default: All modules enabled

+ docker run -e DISABLEMODULE_DOM=true -e DISABLEMODULE_XSL=true byjg/php:8.3-cli +
+ +
+

VERBOSE

+

Description: Enable verbose logging for troubleshooting startup and configuration

+

Default: Not set

+ docker run -e VERBOSE=true byjg/php:8.3-cli +
+
+ +
+

📊 Image Information

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyValue
Base OSAlpine Linux
Supported Architecturesamd64, arm64
Supported PHP Versions5.6, 7.0-7.4, 8.0-8.5
Image Variantsbase, cli, fpm, fpm-nginx, fpm-apache
Web ServerNginx / Apache
XDebug Port9001
+
+ +
+

ðŸŽŊ Quick Start Examples

+
+

Development Environment

+ docker run -d -v $PWD:/var/www/html -p 80:80 byjg/php:8.3-fpm-nginx +
+ +
+

With Framework (Laravel, Symfony)

+ docker run -d \ + -e PHP_CONTROLLER="/index.php" \ + -e NGINX_ROOT="/var/www/html/public" \ + -v $PWD:/var/www/html \ + -p 80:80 \ + byjg/php:8.3-fpm-nginx +
+ +
+

Production with SSL

+ docker run -d \ + -e NGINX_SSL_CERT=/etc/ssl/cert.pem \ + -e NGINX_SSL_CERT_KEY=/etc/ssl/key.pem \ + -v /path/to/certs:/etc/ssl \ + -v $PWD:/var/www/html \ + -p 443:443 \ + byjg/php:8.3-fpm-nginx +
+
+ +
+

🔍 Explore More

+

View detailed PHP configuration and loaded extensions

+ View PHP Info + Full Documentation + GitHub Repository +
+
+ +
+

ByJG PHP Docker Images | Open Source ByJG

+

Licensed under MIT | Built with âĪïļ for the PHP Community

+
+
+ + diff --git a/generator/__init__.py b/generator/__init__.py index c78cb7c..dbc7b5b 100644 --- a/generator/__init__.py +++ b/generator/__init__.py @@ -134,6 +134,7 @@ def build_fpm_apache(self): self.dockerfile_content["copy"] += "COPY assets/fpm-apache/conf/vhost.conf /etc/apache2/conf.d/\n" self.dockerfile_content["copy"] += "COPY assets/fpm-apache/conf/supervisord.conf /etc/supervisord.conf\n" self.dockerfile_content["copy"] += "COPY assets/script/exit-event-listener.py /exit-event-listener.py\n" + self.dockerfile_content["copy"] += "COPY assets/index.html /tmp/index.html\n" return self._build() def build_fpm_nginx(self): @@ -145,6 +146,7 @@ def build_fpm_nginx(self): self.dockerfile_content["copy"] += "COPY assets/fpm-nginx/conf/supervisord.conf /etc/supervisord.conf\n" self.dockerfile_content["copy"] += "COPY assets/script/exit-event-listener.py /exit-event-listener.py\n" self.dockerfile_content["copy"] += "COPY assets/script/start-nginx.sh /start-nginx.sh\n" + self.dockerfile_content["copy"] += "COPY assets/index.html /tmp/index.html\n" self.dockerfile_content["run"] += "RUN " + self.parse_config("php-fpm-nginx.j2") + "\n" return self._build() @@ -159,4 +161,5 @@ def build_nginx(self): self.dockerfile_content["copy"] += "COPY assets/fpm-nginx/conf/nginx.vh.default.conf /etc/nginx/http.d/default.conf\n" self.dockerfile_content["copy"] += "COPY assets/script/start-nginx.sh /start-nginx.sh\n" self.dockerfile_content["copy"] += "COPY assets/entrypoint.sh /\n" + self.dockerfile_content["copy"] += "COPY assets/index.html /tmp/index.html\n" return self._build() diff --git a/templates/php-fpm-apache.j2 b/templates/php-fpm-apache.j2 index 6f92dbb..cb892c8 100644 --- a/templates/php-fpm-apache.j2 +++ b/templates/php-fpm-apache.j2 @@ -5,5 +5,6 @@ mkdir -p /run/apache2 chmod a+x /start-fpm.sh (ln -s /usr/bin/python3 /usr/bin/python || true) echo "" >> /var/www/localhost/htdocs/info.php +cp /tmp/index.html /var/www/localhost/htdocs/index.html date > /etc/build-date diff --git a/templates/php-fpm-nginx.j2 b/templates/php-fpm-nginx.j2 index 39a34d8..4926f83 100644 --- a/templates/php-fpm-nginx.j2 +++ b/templates/php-fpm-nginx.j2 @@ -4,6 +4,7 @@ ln -sf /dev/stdout /var/log/nginx/access.log ln -sf /dev/stderr /var/log/nginx/error.log mkdir -p /var/www/html echo "" >> /var/www/html/info.php +cp /tmp/index.html /var/www/html/index.html rm -rf /etc/nginx/conf.d mkdir -p /run/nginx diff --git a/templates/php-nginx.j2 b/templates/php-nginx.j2 index 5ab0a50..89fce83 100644 --- a/templates/php-nginx.j2 +++ b/templates/php-nginx.j2 @@ -4,6 +4,7 @@ ln -sf /dev/stdout /var/log/nginx/access.log ln -sf /dev/stderr /var/log/nginx/error.log mkdir -p /var/www/html echo "" >> /var/www/html/info.php +cp /tmp/index.html /var/www/html/index.html rm -rf /etc/nginx/conf.d mkdir -p /run/nginx From e728f749248fb17ffb2835bb83cdd1af9ebe8e54 Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Fri, 14 Nov 2025 16:51:25 -0500 Subject: [PATCH 2/3] Update Docker image build process and improve documentation Refactored build scripts to process `index.html` with build-time variables for dynamic content. Updated `index.html` with enhanced styling, examples, and placeholders. Adjusted Nginx and Apache templates to replace `cp` with `mv` for `index.html`. Upgraded dependencies in `requirements.txt`. --- assets/fpm-apache/conf/vhost.conf | 2 +- assets/index.html | 146 ++++++++++++++++++++++++------ generator/__init__.py | 23 ++++- requirements.txt | 7 +- templates/php-fpm-apache.j2 | 2 +- templates/php-fpm-nginx.j2 | 1 - templates/php-nginx.j2 | 1 - 7 files changed, 141 insertions(+), 41 deletions(-) diff --git a/assets/fpm-apache/conf/vhost.conf b/assets/fpm-apache/conf/vhost.conf index f2236dc..fd7ca88 100644 --- a/assets/fpm-apache/conf/vhost.conf +++ b/assets/fpm-apache/conf/vhost.conf @@ -19,7 +19,7 @@ DocumentRoot "/var/www/localhost/htdocs" # Options Indexes FollowSymLinks - DirectoryIndex index.php index.html + DirectoryIndex index.html # # AllowOverride controls what directives may be placed in .htaccess files. diff --git a/assets/index.html b/assets/index.html index f8430bf..5da5b43 100644 --- a/assets/index.html +++ b/assets/index.html @@ -150,6 +150,40 @@ margin-top: 10px; font-family: 'Courier New', monospace; font-size: 0.9em; + white-space: pre-wrap; + } + + .examples-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); + gap: 20px; + margin-top: 15px; + } + + .example-box { + background: #f8f9fa; + border-left: 4px solid #667eea; + padding: 15px; + border-radius: 4px; + } + + .example-box h4 { + color: #283E51; + margin-bottom: 10px; + font-size: 1em; + } + + .example-box code { + background: #2d2d2d; + color: #f8f8f2; + padding: 15px; + display: block; + border-radius: 5px; + overflow-x: auto; + margin-top: 10px; + font-family: 'Courier New', monospace; + font-size: 0.85em; + white-space: pre-wrap; } .cta-section { @@ -241,6 +275,10 @@ .feature-grid { grid-template-columns: 1fr; } + + .examples-grid { + grid-template-columns: 1fr; + } } @@ -351,14 +389,14 @@

PHP_CONTROLLER

Description: Enable single-file controller pattern. All requests route to the specified PHP file.

Default: Not set

Use Case: Perfect for Symfony, Laravel, Slim frameworks

- docker run -e PHP_CONTROLLER=/index.php byjg/php:8.3-fpm-nginx + docker run -e PHP_CONTROLLER=/index.php @@DOCKER_IMAGE@@

NGINX_ROOT

Description: Set the web server document root

Default: /var/www/html

- docker run -e NGINX_ROOT=/srv/public byjg/php:8.3-fpm-nginx + docker run -e NGINX_ROOT=/srv/public @@DOCKER_IMAGE@@
@@ -368,28 +406,28 @@

NGINX_SSL_CERT & NGINX_SSL_CERT_KEY

docker run -v /etc/ssl:/etc/ssl \ -e NGINX_SSL_CERT=/etc/ssl/my.cert \ -e NGINX_SSL_CERT_KEY=/etc/ssl/my.key \ - byjg/php:8.3-fpm-nginx + @@DOCKER_IMAGE@@

PHP_FPM_SERVER

Description: Configure the FastCGI server address for PHP-FPM

Default: 127.0.0.1:9000

- docker run -e PHP_FPM_SERVER=127.0.0.1:9000 byjg/php:8.3-fpm-nginx + docker run -e PHP_FPM_SERVER=127.0.0.1:9000 @@DOCKER_IMAGE@@

DISABLEMODULE_[name]

Description: Disable specific PHP modules at runtime to optimize performance

Default: All modules enabled

- docker run -e DISABLEMODULE_DOM=true -e DISABLEMODULE_XSL=true byjg/php:8.3-cli + docker run -e DISABLEMODULE_DOM=true -e DISABLEMODULE_XSL=true @@DOCKER_IMAGE@@

VERBOSE

Description: Enable verbose logging for troubleshooting startup and configuration

Default: Not set

- docker run -e VERBOSE=true byjg/php:8.3-cli + docker run -e VERBOSE=true @@DOCKER_IMAGE@@
@@ -401,24 +439,28 @@

📊 Image Information

Value - Base OS - Alpine Linux + Docker Image + @@DOCKER_IMAGE@@ - Supported Architectures - amd64, arm64 + PHP Version + @@PHP_VERSION@@ + + + PHP Variant + @@PHP_VARIANT@@ - Supported PHP Versions - 5.6, 7.0-7.4, 8.0-8.5 + Build Date + @@BUILD_DATE@@ - Image Variants - base, cli, fpm, fpm-nginx, fpm-apache + Base OS + Alpine Linux - Web Server - Nginx / Apache + Supported Architectures + amd64, arm64 XDebug Port @@ -429,30 +471,76 @@

📊 Image Information

ðŸŽŊ Quick Start Examples

-
-

Development Environment

- docker run -d -v $PWD:/var/www/html -p 80:80 byjg/php:8.3-fpm-nginx + +

Development Environment

+
+
+

ðŸ”đ Using docker run

+ docker run -d \ + -v $PWD:/var/www/html \ + -p 80:80 \ + @@DOCKER_IMAGE@@ +
+
+

ðŸ”đ Using Dockerfile

+ FROM @@DOCKER_IMAGE@@ + +COPY . /var/www/html + +EXPOSE 80 +
-
-

With Framework (Laravel, Symfony)

- docker run -d \ +

With Framework (Laravel, Symfony, PHP Rest Reference)

+
+
+

ðŸ”đ Using docker run

+ docker run -d \ -e PHP_CONTROLLER="/index.php" \ - -e NGINX_ROOT="/var/www/html/public" \ - -v $PWD:/var/www/html \ + -e NGINX_ROOT="/srv/public" \ + -v $PWD:/svr \ + -w /svr \ -p 80:80 \ - byjg/php:8.3-fpm-nginx + @@DOCKER_IMAGE@@
+
+
+

ðŸ”đ Using Dockerfile

+ FROM @@DOCKER_IMAGE@@ + +ENV PHP_CONTROLLER="/index.php" +ENV NGINX_ROOT="/svr/public" +WORKDIR /svr + +COPY . /svr + +EXPOSE 80 +
-
-

Production with SSL

- docker run -d \ +

Production with SSL

+
+
+

ðŸ”đ Using docker run

+ docker run -d \ -e NGINX_SSL_CERT=/etc/ssl/cert.pem \ -e NGINX_SSL_CERT_KEY=/etc/ssl/key.pem \ -v /path/to/certs:/etc/ssl \ -v $PWD:/var/www/html \ -p 443:443 \ - byjg/php:8.3-fpm-nginx + @@DOCKER_IMAGE@@
+
+
+

ðŸ”đ Using Dockerfile

+ FROM @@DOCKER_IMAGE@@ + +ENV NGINX_SSL_CERT=/etc/ssl/cert.pem +ENV NGINX_SSL_CERT_KEY=/etc/ssl/key.pem + +COPY certs/ /etc/ssl/ +COPY . /var/www/html + +EXPOSE 443 +
diff --git a/generator/__init__.py b/generator/__init__.py index dbc7b5b..afd3523 100644 --- a/generator/__init__.py +++ b/generator/__init__.py @@ -135,7 +135,15 @@ def build_fpm_apache(self): self.dockerfile_content["copy"] += "COPY assets/fpm-apache/conf/supervisord.conf /etc/supervisord.conf\n" self.dockerfile_content["copy"] += "COPY assets/script/exit-event-listener.py /exit-event-listener.py\n" self.dockerfile_content["copy"] += "COPY assets/index.html /tmp/index.html\n" - return self._build() + image = self._build() + # Process index.html with build-time variables + self.dockerfile_content["run"] += "RUN sed -i " + \ + f"-e 's|@@DOCKER_IMAGE@@|{image}|g' " + \ + f"-e 's|@@PHP_VERSION@@|{self.build_config['version']['major']}.{self.build_config['version']['minor']}|g' " + \ + f"-e 's|@@PHP_VARIANT@@|php{self.build_config['version']['suffix']}|g' " + \ + f"-e 's|@@BUILD_DATE@@|{self.build_date}|g' " + \ + "/var/www/localhost/htdocs/index.html\n" + return image def build_fpm_nginx(self): self._banner("fpm-nginx") @@ -146,9 +154,16 @@ def build_fpm_nginx(self): self.dockerfile_content["copy"] += "COPY assets/fpm-nginx/conf/supervisord.conf /etc/supervisord.conf\n" self.dockerfile_content["copy"] += "COPY assets/script/exit-event-listener.py /exit-event-listener.py\n" self.dockerfile_content["copy"] += "COPY assets/script/start-nginx.sh /start-nginx.sh\n" - self.dockerfile_content["copy"] += "COPY assets/index.html /tmp/index.html\n" - self.dockerfile_content["run"] += "RUN " + self.parse_config("php-fpm-nginx.j2") + "\n" - return self._build() + self.dockerfile_content["copy"] += "COPY assets/index.html /var/www/html/index.html\n" + image = self._build() + # Process index.html with build-time variables + self.dockerfile_content["run"] += "RUN sed -i " + \ + f"-e 's|@@DOCKER_IMAGE@@|{image}|g' " + \ + f"-e 's|@@PHP_VERSION@@|{self.build_config['version']['major']}.{self.build_config['version']['minor']}|g' " + \ + f"-e 's|@@PHP_VARIANT@@|php{self.build_config['version']['suffix']}|g' " + \ + f"-e 's|@@BUILD_DATE@@|{self.build_date}|g' " + \ + "/var/www/html/index.html\n" + return image def build_nginx(self): self._banner("nginx") diff --git a/requirements.txt b/requirements.txt index 690a2b4..91f3925 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ -Jinja2==3.1.4 +Jinja2==3.1.6 jinja2-cli==0.8.2 -MarkupSafe==2.1.5 -argparse==1.4.0 -PyYAML==6.0.1 \ No newline at end of file +MarkupSafe==3.0.3 +PyYAML==6.0.3 \ No newline at end of file diff --git a/templates/php-fpm-apache.j2 b/templates/php-fpm-apache.j2 index cb892c8..aa7079f 100644 --- a/templates/php-fpm-apache.j2 +++ b/templates/php-fpm-apache.j2 @@ -5,6 +5,6 @@ mkdir -p /run/apache2 chmod a+x /start-fpm.sh (ln -s /usr/bin/python3 /usr/bin/python || true) echo "" >> /var/www/localhost/htdocs/info.php -cp /tmp/index.html /var/www/localhost/htdocs/index.html +mv /tmp/index.html /var/www/localhost/htdocs/index.html date > /etc/build-date diff --git a/templates/php-fpm-nginx.j2 b/templates/php-fpm-nginx.j2 index 4926f83..39a34d8 100644 --- a/templates/php-fpm-nginx.j2 +++ b/templates/php-fpm-nginx.j2 @@ -4,7 +4,6 @@ ln -sf /dev/stdout /var/log/nginx/access.log ln -sf /dev/stderr /var/log/nginx/error.log mkdir -p /var/www/html echo "" >> /var/www/html/info.php -cp /tmp/index.html /var/www/html/index.html rm -rf /etc/nginx/conf.d mkdir -p /run/nginx diff --git a/templates/php-nginx.j2 b/templates/php-nginx.j2 index 89fce83..5ab0a50 100644 --- a/templates/php-nginx.j2 +++ b/templates/php-nginx.j2 @@ -4,7 +4,6 @@ ln -sf /dev/stdout /var/log/nginx/access.log ln -sf /dev/stderr /var/log/nginx/error.log mkdir -p /var/www/html echo "" >> /var/www/html/info.php -cp /tmp/index.html /var/www/html/index.html rm -rf /etc/nginx/conf.d mkdir -p /run/nginx From 9b33876248b6734d58e528c0b02486037132cc65 Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Fri, 14 Nov 2025 16:56:02 -0500 Subject: [PATCH 3/3] Update Docker image build process and improve documentation Refactored build scripts to process `index.html` with build-time variables for dynamic content. Updated `index.html` with enhanced styling, examples, and placeholders. Adjusted Nginx and Apache templates to replace `cp` with `mv` for `index.html`. Upgraded dependencies in `requirements.txt`. --- assets/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/index.html b/assets/index.html index 5da5b43..d3df80d 100644 --- a/assets/index.html +++ b/assets/index.html @@ -554,7 +554,7 @@

🔍 Explore More