Skip to content

Commit 574e3c1

Browse files
committed
Add Debian 13 Trixie
1 parent ebfc17f commit 574e3c1

24 files changed

Lines changed: 522 additions & 4 deletions

File tree

.github/workflows/multi-build-push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
build_and_push:
2020
strategy:
2121
matrix:
22-
version: ["debian12", "debian11"]
22+
version: ["debian13", "debian12", "debian11"]
2323

2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
2828

2929
- name: Get repo name
3030
id: image_name

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2024 Volt Grid Pty Ltd
3+
Copyright (c) 2015-2025 Volt Grid Pty Ltd
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SUBDIRS := centos7 centos7-develop debian9 debian10 debian11 debian12 sid
1+
SUBDIRS := centos7 centos7-develop debian9 debian10 debian11 debian12 debian13 sid
22

33
.PHONY: build push clean
44

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ These images are available from the [Docker Hub](https://hub.docker.com/r/panubo
1010

1111
- [Debian 11 (Bullseye) Base](/debian11) - Recommended for PHP applications that require PHP 7.4
1212
- [Debian 12 (Bookworm) Base](/debian12) - Recommended for PHP applications that require PHP 8.2
13+
- [Debian 13 (Trixie) Base](/debian13) - Recommended for PHP applications that require PHP 8.4
1314

1415
## Development Images
1516

debian13/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.md
2+
test

debian13/Dockerfile

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Panubo PHP-Apache
2+
#
3+
# Debian bookworm
4+
# PHP 8.4
5+
# Apache 2.4
6+
# Mongo support
7+
#
8+
9+
FROM debian:13
10+
11+
# Component Versions
12+
ENV \
13+
BASHCONTAINER_VERSION=0.8.0 BASHCONTAINER_SHA256=0ddc93b11fd8d6ac67f6aefbe4ba790550fc98444e051e461330f10371a877f1 \
14+
PHPEXTRAS_VERSION=0.1.0 PHPEXTRAS_SHA256=515af5789d5180123acfac9b1090f46e07f355c8df51a34e27ada5f7da0495cc
15+
16+
# Change the www-data use to uid and gid 48 to match other containers
17+
RUN \
18+
usermod -u 48 www-data && \
19+
groupmod -g 48 www-data
20+
21+
# Install bash-container functions
22+
RUN set -x \
23+
&& if ! command -v wget > /dev/null; then \
24+
fetchDeps="${fetchDeps} wget"; \
25+
fi \
26+
&& apt-get update \
27+
&& apt-get install -y --no-install-recommends ca-certificates curl ${fetchDeps} \
28+
&& cd /tmp \
29+
&& wget -nv https://github.com/panubo/bash-container/releases/download/v${BASHCONTAINER_VERSION}/panubo-functions.tar.gz \
30+
&& echo "${BASHCONTAINER_SHA256} panubo-functions.tar.gz" > /tmp/SHA256SUM \
31+
&& ( cd /tmp; sha256sum -c SHA256SUM || ( echo "Expected $(sha256sum panubo-functions.tar.gz)"; exit 1; )) \
32+
&& tar --no-same-owner -C / -zxf panubo-functions.tar.gz \
33+
&& rm -rf /tmp/* \
34+
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false ${fetchDeps} \
35+
&& apt-get clean \
36+
&& rm -rf /var/lib/apt/lists/* \
37+
;
38+
39+
# Install gomplate
40+
RUN set -x \
41+
&& GOMPLATE_VERSION=v4.3.3 \
42+
&& GOMPLATE_CHECKSUM_X86_64=ca281666e86f2f09218c1653e1908f572c0e349e9de64cb4ea93ade9333f0596 \
43+
&& GOMPLATE_CHECKSUM_AARCH64=25bd73720ff470cec0dfaa31ca2c436b30f86142db9af68382ce64e0f3e7b9c5 \
44+
&& if [ "$(uname -m)" = "x86_64" ] ; then \
45+
GOMPLATE_CHECKSUM="${GOMPLATE_CHECKSUM_X86_64}"; \
46+
GOMPLATE_ARCH="amd64"; \
47+
elif [ "$(uname -m)" = "aarch64" ]; then \
48+
GOMPLATE_CHECKSUM="${GOMPLATE_CHECKSUM_AARCH64}"; \
49+
GOMPLATE_ARCH="arm64"; \
50+
fi \
51+
&& curl -sSf -o /tmp/gomplate_linux-${GOMPLATE_ARCH} -L https://github.com/hairyhenderson/gomplate/releases/download/${GOMPLATE_VERSION}/gomplate_linux-${GOMPLATE_ARCH} \
52+
&& echo "${GOMPLATE_CHECKSUM} gomplate_linux-${GOMPLATE_ARCH}" > /tmp/SHA256SUM \
53+
&& ( cd /tmp; sha256sum -c SHA256SUM || ( echo "Expected $(sha256sum gomplate_linux-${GOMPLATE_ARCH})"; exit 1; )) \
54+
&& install -m 0755 /tmp/gomplate_linux-${GOMPLATE_ARCH} /usr/local/bin/gomplate \
55+
&& rm -f /tmp/* \
56+
;
57+
58+
# Install PHP Extras
59+
RUN set -x \
60+
&& if ! command -v wget > /dev/null; then \
61+
fetchDeps="${fetchDeps} wget"; \
62+
fi \
63+
&& apt-get update \
64+
&& apt-get install -y --no-install-recommends ${fetchDeps} \
65+
&& cd /tmp \
66+
&& wget -nv https://github.com/panubo/php-extras/releases/download/v${PHPEXTRAS_VERSION}/php-extras.tar.gz \
67+
&& echo "${PHPEXTRAS_SHA256} php-extras.tar.gz" > /tmp/SHA256SUM \
68+
&& ( cd /tmp; sha256sum -c SHA256SUM || ( echo "Expected $(sha256sum php-extras.tar.gz)"; exit 1; )) \
69+
&& mkdir -p /usr/share/php/ \
70+
&& tar --no-same-owner -C /usr/share/php/ -zxf php-extras.tar.gz \
71+
&& rm -rf /tmp/* \
72+
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false ${fetchDeps} \
73+
&& apt-get clean \
74+
&& rm -rf /var/lib/apt/lists/* \
75+
;
76+
77+
# Install main packages
78+
# IMAP not available
79+
# ref: https://www.reddit.com/r/debian/comments/1mu271u/php_84_desperately_need_imap_support/
80+
# php8.4-imap \
81+
RUN \
82+
export DEBIAN_FRONTEND=noninteractive && \
83+
apt-get update && \
84+
apt-get install --no-install-recommends --no-install-suggests -y wget curl ca-certificates git gnupg openssh-client msmtp-mta apache2 libapache2-mod-xsendfile imagemagick ghostscript s6 \
85+
php8.4-apcu \
86+
php8.4-cli \
87+
php8.4-curl \
88+
php8.4-dom \
89+
php8.4-fpm \
90+
php8.4-gd \
91+
php8.4-igbinary \
92+
php8.4-imagick \
93+
php8.4-intl \
94+
php8.4-ldap \
95+
php8.4-mbstring \
96+
php8.4-memcached \
97+
php8.4-mongodb \
98+
php8.4-mysql \
99+
php8.4-pgsql \
100+
php8.4-pspell \
101+
php8.4-redis \
102+
php8.4-sqlite \
103+
php8.4-xmlrpc \
104+
php8.4-zip && \
105+
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/www/html/*
106+
107+
# Configure
108+
RUN \
109+
mkdir -p /root/.ssh && \
110+
echo "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config && \
111+
sed -i -e '/^session.save_/ s/^/;/' /etc/php/8.4/*/php.ini && \
112+
touch /etc/php/8.4/mods-available/auto.ini && \
113+
touch /var/log/msmtp.log && \
114+
chown www-data:www-data /var/log/msmtp.log && \
115+
sed -i -r 's/^Listen.*/Listen 8000/g' /etc/apache2/ports.conf && \
116+
sed -i 's/^error_log.*/error_log = \/dev\/stderr/' /etc/php/8.4/fpm/php-fpm.conf && \
117+
sed -i -E 's/^;?systemd_interval.*/systemd_interval = 0/' /etc/php/8.4/fpm/php-fpm.conf && \
118+
mv /etc/php/8.4/fpm/pool.d/www.conf /etc/php/8.4/fpm/pool.d/www.conf_orig && \
119+
mkdir -p /var/log/php-fpm
120+
121+
# Copy configs and templates
122+
COPY etc /etc
123+
COPY root /
124+
125+
# Enable modules / configs
126+
RUN \
127+
phpenmod session mongodb && \
128+
a2dissite 000-default && \
129+
a2disconf security other-vhosts-access-log && \
130+
phpenmod auto && \
131+
a2enconf php8.4-fpm && \
132+
a2enmod proxy_fcgi remoteip rewrite headers
133+
134+
ENV TMPDIR=/var/tmp TERM=dumb
135+
EXPOSE 8000
136+
ENTRYPOINT ["/entry.sh"]
137+
CMD ["s6"]

debian13/Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
NAME = php-apache
2+
TAG = $(shell basename $(shell pwd))
3+
IMAGE_NAME := panubo/$(NAME)
4+
5+
.PHONY: help build buildarm buildamd push clean bash run
6+
7+
help:
8+
@printf "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)\n"
9+
10+
build: ## build image
11+
docker build --pull -t $(IMAGE_NAME):$(TAG) .
12+
13+
buildarm: ## build image
14+
docker build --platform=linux/arm64 --pull -t $(IMAGE_NAME):$(TAG) .
15+
16+
buildamd: ## build image
17+
docker build --platform=linux/amd64 --pull -t $(IMAGE_NAME):$(TAG) .
18+
19+
push: ## Push image to registry
20+
docker tag $(IMAGE_NAME):$(TAG) docker.io/$(IMAGE_NAME):latest
21+
docker push $(IMAGE_NAME):$(TAG)
22+
docker push $(IMAGE_NAME):latest
23+
24+
clean: ## Remove built image
25+
docker rmi $(IMAGE_NAME):$(TAG)
26+
27+
bash: ## Runs bash in the container
28+
docker run --rm -it -v $(shell pwd)/test:/srv/remote $(IMAGE_NAME):$(TAG) bash
29+
30+
run: ## Runs the container with test data
31+
docker run --rm -it -p 8000:8000 -v $(shell pwd)/test:/srv/remote --name $(NAME) $(IMAGE_NAME):$(TAG)
32+
33+
_ci_test:
34+
true
35+
36+
_ci_version:
37+
@echo $(TAG)

debian13/README.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# PHP-Apache Debian 13 (Trixie)
2+
3+
This is an Apache and php-fpm image:
4+
5+
- Base: Debian 13 (Trixie)
6+
- Apache httpd: 2.4
7+
- PHP: 8.4
8+
9+
This image is designed to be quite configurable and as such is good for getting
10+
started but probably not a great base if you want a highly optimised container.
11+
This image also expects to be used behind a load balancer and as such does not
12+
listen on port 80 but instead port 8000. Also make note of how to handle SSL
13+
offloading to the load balancer and how this affects .htaccess rules.
14+
15+
Note: Unlike the other images this does not provide php-imap due to Debian packaging issues.
16+
17+
## Options:
18+
19+
All options are optional.
20+
The values shown here are the defaults. The options listed here are also case sensitive.
21+
22+
### Global
23+
24+
```
25+
timeout = 30
26+
TZ = UTC
27+
```
28+
29+
### HTTPD
30+
31+
```
32+
httpd_remoteipheader = X-Forwarded-For
33+
httpd_remoteipinternalproxy = (unset)
34+
35+
# Subdirectory within the git repository that contains the site root eg 'www'
36+
httpd_root = (unset)
37+
38+
# If unset the following is used
39+
RemoteIPInternalProxy 10.0.0.0/8
40+
RemoteIPInternalProxy 172.16.0.0/12
41+
RemoteIPInternalProxy 192.168.0.0/16
42+
```
43+
44+
### PHP/PHP-FPM
45+
46+
```
47+
phpopts_ = (unset)
48+
49+
# phpopts Examples
50+
phpopts_short_open_tag = off
51+
phpopts_post_max_size = 8M
52+
phpopts_upload_max_filesize = 2M
53+
phpopts_memory_limit = 128M
54+
55+
# PHP Cache options
56+
php_cache = (opcache|none) default is opcache, none doesn't load any cache extensions.
57+
php_apc_shm_size = 64M # This is for the apcu extension
58+
php_opcache_memory_consumption = 128
59+
php_opcache_revalidate_freq = 2
60+
61+
# PHP Session options
62+
php_session_save_handler = (unset)
63+
php_session_save_path = (unset)
64+
65+
# PHP Session examples
66+
php_session_save_handler = redis
67+
php_session_save_path = "tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout=2.5, tcp://host3:6379?weight=2"
68+
69+
php_session_save_handler = memcached
70+
php_session_save_path = "host:11211"
71+
72+
# PHP-FPM options
73+
phpfpm_pm_max_children = 3
74+
phpfpm_pm_max_requests = 500
75+
```
76+
77+
### Email/msmtp
78+
79+
msmtp expects a from address to be set either via environment variable (`msmtp_from`) or
80+
in the php mail() function. eg. `mail('nobody@example.com', 'the subject',
81+
'the message', null, '-fwebmaster@example.com');`
82+
83+
msmtp also need a host to send email via, it does not queue and forward mail
84+
like postfix or exim. This could be defined via a docker link `--link
85+
smtp:smtp`
86+
87+
```
88+
msmtp_host = SMTP_PORT_25_TCP_ADDR or mail
89+
msmtp_port = SMTP_PORT_25_TCP_PORT or 25
90+
msmtp_from = (unset)
91+
msmtp_user = (unset)
92+
msmtp_pass = (unset)
93+
```
94+
95+
## PHP Pre Execution
96+
97+
PHP pre-execution helpers are included in this image. See
98+
[PHP Extras](https://github.com/panubo/php-extras) for more information.
99+
100+
Set `auto_prepend_file=xxxx_prepend.php` to enable.
101+
102+
## SSL Offloading
103+
104+
This container should be used behind a load balancing reverse proxy and as such
105+
SSL should be offloaded to the load balancer. However, this can cause issues
106+
when your applications want to know if they are being served over SSL as the
107+
local webserver cannot determine this. Below are workarounds for the two most common
108+
issues.
109+
110+
If you want to redirect users from a non-ssl connection to a SSL connection with
111+
htaccess and mod_rewrite the following rules work both behind an SSL offloading
112+
load balancer and also when the local webserver is handling the SSL.
113+
114+
```
115+
<IfModule mod_rewrite.c>
116+
RewriteEngine on
117+
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
118+
RewriteCond %{HTTPS} !=on
119+
RewriteRule ^(.*) https://%{HTTP_HOST}/$1 [R=301,L]
120+
</IfModule>
121+
```
122+
123+
Some PHP application also check they are running on an SSL connection. As the
124+
local webserver doesn't set $_SERVER['HTTPS'] correctly when behind a proxy the
125+
following code can be used to fix the issue.
126+
127+
```php
128+
/* Set _SERVER['HTTPS'] correctly when behind a proxy setting HTTP_X_FORWARDED_PROTO */
129+
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
130+
$_SERVER['HTTPS'] = 'on';
131+
}
132+
```
133+
134+
or set `auto_prepend_file=SSLHelper_prepend.php` to use the SSL Helper from the [PHP Extras](https://github.com/panubo/php-extras) repo.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{{- define "get_httpd_root" -}}
2+
{{ if getenv "httpd_root" -}}/var/www/html/{{ getenv "httpd_root" }}{{ else }}/var/www/html{{ end }}
3+
{{- end -}}
4+
5+
DocumentRoot "{{- template "get_httpd_root" -}}"
6+
<Directory "{{- template "get_httpd_root" -}}">
7+
Options Indexes FollowSymLinks
8+
AllowOverride All
9+
Require all granted
10+
</Directory>
11+
12+
RemoteIPHeader {{ getenv "httpd_remoteipheader" "X-Forwarded-For" }}
13+
{{ if getenv "httpd_remoteipinternalproxy" -}}
14+
RemoteIPInternalProxy {{ getenv "httpd_remoteipinternalproxy" }}
15+
{{ else -}}
16+
RemoteIPInternalProxy 10.0.0.0/8
17+
RemoteIPInternalProxy 172.16.0.0/12
18+
RemoteIPInternalProxy 192.168.0.0/16
19+
{{ end -}}
20+
21+
DirectoryIndex index.php index.html index.htm
22+
23+
<LocationMatch "^/(.*\.php)$">
24+
ProxyPass fcgi://127.0.0.1:9000{{- template "get_httpd_root" -}}/$1 connectiontimeout=10 timeout={{ getenv "timeout" "30" }}
25+
</LocationMatch>
26+
27+
<FilesMatch "\.ph(p[345]?|t|tml|ps)$">
28+
Require all denied
29+
</FilesMatch>
30+
31+
LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
32+
33+
CustomLog "/dev/stdout" combined
34+
ErrorLog "/dev/stderr"
35+
36+
ServerTokens Minor
37+
ServerSignature On

0 commit comments

Comments
 (0)