Skip to content

Commit fa56e0d

Browse files
committed
(wip)
1 parent 432890d commit fa56e0d

File tree

4 files changed

+44
-12
lines changed

4 files changed

+44
-12
lines changed

.github/workflows/docker-build.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
name:
1010
type: string
1111
required: true
12+
template:
13+
type: string
14+
required: false
1215
base:
1316
type: string
1417
required: true
@@ -62,7 +65,7 @@ jobs:
6265
DOCKER_BUILD_IMAP_VERSION: ${{ inputs.imap_version }}
6366
DOCKER_BUILD_PHP_ERRORS_ENABLED: ${{ inputs.php_erros_enabled && '1' || '0' }}
6467
run: |
65-
go-replace --mode=template ./Dockerfile.tmpl -o ./Dockerfile
68+
go-replace --mode=template ./${{ input.template }} -o ./Dockerfile
6669
6770
- name: dump Dockerfile
6871
run: cat Dockerfile

.github/workflows/setup-build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
with:
3939
name: ${{ matrix.config.name }}
4040
base: ${{ matrix.config.base }}
41+
base: ${{ matrix.config.template || "Dockerfile.tmpl" }}
4142
version: ${{ matrix.config.version }}
4243
xdebug_version: ${{ matrix.config.xdebug_version }}
4344
redis_version: ${{ matrix.config.redis_version }}

Dockerfile.swoole renamed to Dockerfile.swoole.tmpl

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# Container Base
2-
FROM php:8.3-apache-bookworm
1+
{{ $version := float64 (env "DOCKER_BUILD_VERSION") -}}
2+
FROM {{ env "DOCKER_BUILD_BASE" }}
33

44
ENV \
55
NR_ENABLED=false \
66
NR_APP_NAME="" \
77
NR_LICENSE_KEY="" \
88
NR_VERSION="" \
9-
PHP_BUILD_DATE="20211130" \
109
PHP_OPCACHE_ENABLED=false \
1110
SESSION_HANDLER=false \
1211
SESSION_HANDLER_NAME="" \
@@ -15,8 +14,15 @@ ENV \
1514
XDEBUG_CONNECT_BACK=true \
1615
XDEBUG_ENABLED=false \
1716
XDEBUG_IDEKEY="docker" \
18-
XDEBUG_VERSION="-3.3.2" \
19-
REDIS_VERSION="-5.3.7" \
17+
XDEBUG_VERSION="{{ if not (eq (env "DOCKER_BUILD_XDEBUG_VERSION") "") -}}
18+
-{{ env "DOCKER_BUILD_XDEBUG_VERSION" }}
19+
{{- end }}" \
20+
REDIS_VERSION="{{ if not (eq (env "DOCKER_BUILD_REDIS_VERSION") "") -}}
21+
-{{ env "DOCKER_BUILD_REDIS_VERSION" }}
22+
{{- end }}" \
23+
IMAP_VERSION="{{ if not (eq (env "DOCKER_BUILD_IMAP_VERSION") "") -}}
24+
-{{ env "DOCKER_BUILD_IMAP_VERSION" }}
25+
{{- end }}" \
2026
XDEBUG_REMOTE_PORT=9000 \
2127
PHP_EXTENSION_WDDX=1 \
2228
PHP_OPENSSL=1 \
@@ -25,13 +31,21 @@ ENV \
2531
RUN apt-get update && apt-get install -y --no-install-recommends wget vim supervisor libfreetype6-dev libjpeg-dev libjpeg62-turbo-dev \
2632
libmcrypt-dev libpng-dev libssl-dev libaio1 git libcurl4-openssl-dev libxslt-dev \
2733
libldap2-dev libicu-dev libc-client-dev libkrb5-dev libsqlite3-dev libedit-dev \
28-
sudo zlib1g zlib1g-dev libzip4 libzip-dev zip unzip librabbitmq-dev musl-dev && \
34+
sudo zlib1g zlib1g-dev libzip4 libzip-dev zip unzip librabbitmq-dev{{ if gt $version 7.4 }} musl-dev{{end}} && \
2935
rm -rf /var/lib/apt/lists/*
3036

3137
RUN docker-php-ext-configure gd --with-jpeg \
3238
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
39+
{{- if eq (env "DOCKER_BUILD_IMAP_TYPE") "php-ext" }}
3340
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
34-
&& docker-php-ext-install -j$(nproc) bcmath gd pdo_mysql calendar exif gettext shmop soap sockets intl pcntl xsl ldap imap ftp
41+
{{- end }}
42+
&& docker-php-ext-install -j$(nproc) bcmath gd pdo_mysql calendar exif gettext shmop soap sockets intl pcntl xsl ldap ftp{{ if eq (env "DOCKER_BUILD_IMAP_TYPE") "php-ext" }} imap{{end}}
43+
{{- if eq (env "DOCKER_BUILD_IMAP_TYPE") "pecl" }}
44+
45+
RUN echo "---> Adding IMAP" && \
46+
pecl install imap${IMAP_VERSION} && \
47+
docker-php-ext-enable imap
48+
{{ end }}
3549

3650
RUN echo "---> Adding Redis" && \
3751
pecl install redis${REDIS_VERSION} && \
@@ -61,6 +75,10 @@ RUN echo "---> Swoole" && \
6175
pecl install swoole -D 'enable-http2="yes"' && \
6276
docker-php-ext-enable swoole
6377

78+
RUN echo "---> Adding Tini" && \
79+
wget -O /tini https://github.com/krallin/tini/releases/download/v0.18.0/tini-static && \
80+
chmod +x /tini
81+
6482
RUN echo "---> Adding NewRelic" && \
6583
apt-get update && apt-get install -y -q --no-install-recommends --no-install-suggests gnupg2 \
6684
&& echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list \
@@ -73,10 +91,6 @@ RUN echo "---> Adding NewRelic" && \
7391
&& echo "newrelic.application_logging.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini \
7492
&& echo "newrelic.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini
7593

76-
RUN echo "---> Adding Tini" && \
77-
wget -O /tini https://github.com/krallin/tini/releases/download/v0.18.0/tini-static && \
78-
chmod +x /tini
79-
8094
RUN echo "---> Config sudoers" && \
8195
echo "www-data ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers
8296

@@ -85,7 +99,9 @@ RUN echo "---> Fix permissions" \
8599
&& mkdir /var/www/.composer && chown -R www-data:www-data /var/www/.composer
86100

87101
COPY configs/logs.conf /etc/apache2/conf-enabled/logs.conf
102+
{{- if eq (env "DOCKER_BUILD_PHP_ERRORS_ENABLED") "1" }}
88103
COPY configs/php-errors.ini /usr/local/etc/php/conf.d/php-errors.ini
104+
{{ end }}
89105
COPY ./bin /usr/bin/
90106

91107
RUN chmod a+x \

config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@
5454
"php_erros_enabled": true,
5555
"variations": ["grpc", "mongodb", "mongodb-1.21.0"]
5656
},
57+
{
58+
"name": "php8dot3-swoole",
59+
"version": "8.3",
60+
"base": "php:8.3-bookworm",
61+
"template": "Dockerfile.swoole.tmpl",
62+
"xdebug_version": "3.3.2",
63+
"redis_version": "5.3.7",
64+
"imap_version": "",
65+
"imap_type": "php-ext",
66+
"php_erros_enabled": true,
67+
"variations": ["grpc"]
68+
},
5769
{
5870
"name": "php8dot4",
5971
"version": "8.4",

0 commit comments

Comments
 (0)