Skip to content

Commit 6b8b64a

Browse files
authored
Merge pull request #79 from sparkfabrik/000-ftp-extension
refs #000: install ftp extension.
2 parents ef47188 + c54d978 commit 6b8b64a

File tree

16 files changed

+253
-4
lines changed

16 files changed

+253
-4
lines changed

.github/workflows/docker-publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
tag: [8-3-2, 8-2-3, 8-1-16, 8-1-10]
17+
tag: [8-4-2, 8-3-15, 8-3-2, 8-2-3, 8-1-16, 8-1-10]
1818
flavour: ["", "-rootless"]
1919
steps:
2020
- uses: actions/checkout@v4
@@ -36,6 +36,8 @@ jobs:
3636
matrix:
3737
tag:
3838
[
39+
8.4.2-fpm-alpine3.21,
40+
8.3.15-fpm-alpine3.21,
3941
8.3.2-fpm-alpine3.18,
4042
8.2.3-fpm-alpine3.16,
4143
8.1.16-fpm-alpine3.16,

8.3/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ ENV XDEBUG_VERSION 3.3.1
3939
ENV MEMCACHE_VERSION 3.2.0
4040
ENV PHPREDIS_VERSION 5.3.7
4141
RUN export XDEBUG_DEPS="linux-headers" && \
42-
export PHP_EXTRA_DEPS="libxml2-dev icu-dev libmemcached-dev cyrus-sasl-dev libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev libzip-dev oniguruma-dev libwebp-dev ldb-dev libldap openldap-dev" && \
42+
export PHP_EXTRA_DEPS="libxml2-dev icu-dev libmemcached-dev cyrus-sasl-dev libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev libzip-dev oniguruma-dev libwebp-dev ldb-dev libldap openldap-dev openssl-dev" && \
4343
apk update && \
4444
apk add ${PHP_EXTRA_DEPS} ${PHPIZE_DEPS} ${XDEBUG_DEPS} gettext && \
4545
docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include && \
4646
docker-php-ext-configure ldap && \
47-
docker-php-ext-install bcmath gd intl mbstring pcntl pdo pdo_mysql soap zip ldap && \
47+
export OPENSSL_LIBS="-L/usr -lssl -lcrypto -lz" && export OPENSSL_CFLAGS="-I/usr/include" && \
48+
docker-php-ext-configure ftp --with-openssl-dir=/usr/include/ && \
49+
docker-php-ext-install bcmath gd intl mbstring pcntl pdo pdo_mysql soap zip ldap ftp && \
4850
pecl install xdebug-${XDEBUG_VERSION} && \
4951
pecl install redis-${PHPREDIS_VERSION} && \
5052
pecl install igbinary memcached-${MEMCACHE_VERSION} --disable-memcached-sasl && \

8.4/Dockerfile

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
ARG PHPVER
2+
3+
FROM golang:1.22.0-alpine3.18 as mailhog
4+
5+
# Install mailhog.
6+
ENV MAILHOG_VERSION 1.0.1
7+
RUN apk add git && \
8+
go install github.com/mailhog/MailHog@v${MAILHOG_VERSION} && \
9+
mv /go/bin/MailHog /go/mailhog
10+
11+
FROM php:$PHPVER as dist
12+
13+
# Build target arch passed by BuildKit
14+
ARG TARGETARCH
15+
16+
# Pass inexistent UUID (e.g.: 1001) to enhance the container security
17+
ARG user=root
18+
19+
# Default php configurations values.
20+
ENV PHP_MEMORY_LIMIT 64M
21+
ENV PHP_TIMEZONE=Europe/Rome
22+
ENV PHP_REALPATH_CACHE_SIZE 2M
23+
ENV PHP_UPLOAD_MAX_FILE_SIZE 32M
24+
ENV PHP_POST_MAX_SIZE 32M
25+
ENV PHP_MAX_EXECUTION_TIME 30
26+
ENV BLACKFIRE_HOST=${BLACKFIRE_HOST:-blackfire}
27+
ENV BLACKFIRE_PORT=${BLACKFIRE_PORT:-8307}
28+
ENV PHP_EXPOSE_PHP 0
29+
30+
# FPM Configurations.
31+
ENV PHP_FPM_PM_TYPE dynamic
32+
ENV PHP_FPM_MAX_CHILDREN 5
33+
ENV PHP_FPM_START_SERVERS 2
34+
ENV PHP_FPM_MIN_SPARE_SERVERS 1
35+
ENV PHP_FPM_MAX_SPARE_SERVERS 3
36+
ENV PHP_FPM_PM_STATUS_PATH /status
37+
38+
ENV XDEBUG_VERSION 3.4.1
39+
ENV MEMCACHE_VERSION 3.3.0
40+
ENV PHPREDIS_VERSION 6.1.0
41+
RUN export XDEBUG_DEPS="linux-headers" && \
42+
export PHP_EXTRA_DEPS="libxml2-dev icu-dev libmemcached-dev cyrus-sasl-dev libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev libzip-dev oniguruma-dev libwebp-dev ldb-dev libldap openldap-dev openssl-dev" && \
43+
apk update && \
44+
apk add ${PHP_EXTRA_DEPS} ${PHPIZE_DEPS} ${XDEBUG_DEPS} gettext && \
45+
docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include && \
46+
docker-php-ext-configure ldap && \
47+
docker-php-ext-configure ftp && \
48+
docker-php-ext-install bcmath gd intl mbstring pcntl pdo pdo_mysql soap zip ldap ftp && \
49+
pecl install xdebug-${XDEBUG_VERSION} && \
50+
pecl install redis-${PHPREDIS_VERSION} && \
51+
pecl install igbinary memcached-${MEMCACHE_VERSION} --disable-memcached-sasl && \
52+
apk del ${PHPIZE_DEPS} ${XDEBUG_DEPS} && \
53+
rm -rf /var/cache/apk/*
54+
55+
# Install APCu.
56+
ENV APCU_VERSION 5.1.24
57+
RUN apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS && \
58+
pecl install apcu-${APCU_VERSION} && \
59+
apk del .phpize-deps-configure
60+
61+
# Install blackfire client.
62+
ENV BLACKFIRE_CLIENT_VERSION 2.8.1
63+
RUN mkdir -p /tmp/blackfire && \
64+
curl -A "Docker" -L https://packages.blackfire.io/binaries/blackfire/${BLACKFIRE_CLIENT_VERSION}/blackfire-linux_${TARGETARCH}.tar.gz | tar zxp -C /tmp/blackfire && \
65+
mv /tmp/blackfire/blackfire /usr/bin/blackfire && \
66+
rm -Rf /tmp/blackfire
67+
68+
# Install blackfire probe.
69+
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
70+
&& architecture=$(uname -m) \
71+
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/alpine/$architecture/$version \
72+
&& mkdir -p /tmp/blackfire \
73+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
74+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
75+
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://\${BLACKFIRE_HOST}:${BLACKFIRE_PORT}\nblackfire.apm_enabled=\${BLACKFIRE_APM_ENABLED}\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
76+
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
77+
78+
# Copy mailhog from golang image.
79+
COPY --from=mailhog /go/mailhog /usr/local/bin/mailhog
80+
RUN chmod +x /usr/local/bin/mailhog
81+
82+
# Configure entrypoint.
83+
COPY docker-entrypoint.sh /docker-entrypoint.sh
84+
RUN chmod +x /docker-entrypoint.sh
85+
86+
# Configure PHP.
87+
COPY conf/*.ini /usr/local/etc/php/conf.d/
88+
COPY conf.disabled /usr/local/etc/php/conf.disabled
89+
COPY fpm-conf-templates/ /templates/
90+
91+
# Make folders writable for the root group
92+
RUN chmod 775 /usr/local/etc/php && \
93+
chmod 775 /usr/local/etc/php/conf.d && \
94+
chmod 775 /usr/local/etc/php-fpm.d && \
95+
chmod 775 /templates
96+
97+
# Go to target user
98+
USER $user
99+
100+
ENTRYPOINT [ "/docker-entrypoint.sh" ]
101+
CMD ["php-fpm"]
102+
103+
FROM dist as dev
104+
105+
# Build target arch passed by BuildKit
106+
ARG TARGETARCH
107+
108+
# Pass inexistent UUID (e.g.: 1001) to enhance the container security
109+
ARG user=root
110+
111+
ARG COMPOSER_VERSION
112+
113+
USER root
114+
115+
ENV COMPOSER_MEMORY_LIMIT -1
116+
ENV COMPOSER_HOME /composer-libs
117+
118+
RUN apk add --no-cache patch rsync git
119+
120+
RUN mkdir $COMPOSER_HOME \
121+
&& chmod -R 775 $COMPOSER_HOME \
122+
&& curl -L -o /usr/local/bin/composer https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar \
123+
&& chmod +x /usr/local/bin/composer \
124+
&& echo "PS1='\[\033[1;36m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\] '" >> /etc/profile \
125+
&& echo "export TERM=xterm" >> /etc/profile
126+
127+
# Go to target user
128+
USER $user

8.4/conf.disabled/apcu.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension=apcu.so

8.4/conf.disabled/mailhog.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sendmail_path="/usr/local/bin/mailhog sendmail --smtp-addr='${MAILHOG_HOST}:${MAILHOG_PORT}' docker@spark.loc"

8.4/conf.disabled/memcached.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
extension=igbinary.so
2+
extension=memcached.so

8.4/conf.disabled/redis.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension=redis.so

8.4/conf.disabled/xdebug.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
zend_extension=xdebug.so
2+
xdebug.start_with_request=yes
3+
xdebug.client_host=${XDEBUG_REMOTE_HOST}
4+
xdebug.mode=develop

8.4/conf/docker.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
realpath_cache_size=${PHP_REALPATH_CACHE_SIZE}
2+
memory_limit=${PHP_MEMORY_LIMIT}
3+
date.timezone=${PHP_TIMEZONE}
4+
upload_max_filesize=${PHP_UPLOAD_MAX_FILE_SIZE}
5+
post_max_size=${PHP_POST_MAX_SIZE}
6+
max_execution_time=${PHP_MAX_EXECUTION_TIME}
7+
max_input_vars=${PHP_MAX_INPUT_VARS}
8+
display_errors=${PHP_DISPLAY_ERRORS}
9+
display_startup_errors=${PHP_DISPLAY_STARTUP_ERRORS}

8.4/conf/expose.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
expose_php="${PHP_EXPOSE_PHP}"

8.4/conf/opcache.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
zend_extension=opcache.so
2+
opcache.enable=${PHP_OPCACHE_ENABLE}
3+
opcache.enable_cli=0
4+
opcache.memory_consumption=${PHP_OPCACHE_MEMORY}
5+
opcache.interned_strings_buffer=8
6+
opcache.max_accelerated_files=100000
7+
opcache.use_cwd=1
8+
opcache.fast_shutdown=1
9+
opcache.revalidate_freq=0

8.4/docker-entrypoint.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/sh
2+
export PHP_MEMORY_LIMIT="${PHP_MEMORY_LIMIT:-"128M"}"
3+
export PHP_TIMEZONE="${PHP_TIMEZONE:-"Europe/Rome"}"
4+
export PHP_OPCACHE_ENABLE="${PHP_OPCACHE_ENABLE:-1}"
5+
export PHP_OPCACHE_MEMORY="${PHP_OPCACHE_MEMORY:-64}"
6+
export PHP_MAX_INPUT_VARS="${PHP_MAX_INPUT_VARS:-3000}"
7+
export PHP_DISPLAY_ERRORS="${PHP_DISPLAY_ERRORS:-0}"
8+
export PHP_DISPLAY_STARTUP_ERRORS="${PHP_DISPLAY_STARTUP_ERRORS:-0}"
9+
10+
# Services.
11+
export MAILHOG_ENABLE="${MAILHOG_ENABLE:-0}"
12+
export MEMCACHED_ENABLE="${MEMCACHED_ENABLE:-0}"
13+
export REDIS_ENABLE="${REDIS_ENABLE:-0}"
14+
export XDEBUG_ENABLE="${XDEBUG_ENABLE:-0}"
15+
export LDAP_ENABLE="${LDAP_ENABLE:-0}"
16+
17+
# Services configurations.
18+
export MAILHOG_HOST="${MAILHOG_HOST:-"mail"}"
19+
export MAILHOG_PORT="${MAILHOG_PORT:-1025}"
20+
export APCU_ENABLE="${APCU_ENABLE:-1}"
21+
22+
# Blackfire configurations.
23+
export BLACKFIRE_APM_ENABLED="${BLACKFIRE_APM_ENABLED:-0}"
24+
25+
if [ "${MEMCACHED_ENABLE}" = "1" ]; then
26+
cp /usr/local/etc/php/conf.disabled/memcached.ini /usr/local/etc/php/conf.d/memcached.ini
27+
else
28+
rm -f /usr/local/etc/php/conf.d/memcached.ini || true
29+
fi
30+
31+
if [ "${REDIS_ENABLE}" = "1" ]; then
32+
cp /usr/local/etc/php/conf.disabled/redis.ini /usr/local/etc/php/conf.d/redis.ini
33+
else
34+
rm -f /usr/local/etc/php/conf.d/redis.ini || true
35+
fi
36+
37+
if [ "${MAILHOG_ENABLE}" = "1" ]; then
38+
cp /usr/local/etc/php/conf.disabled/mailhog.ini /usr/local/etc/php/conf.d/mailhog.ini
39+
else
40+
rm -f /usr/local/etc/php/conf.d/mailhog.ini || true
41+
fi
42+
43+
if [ "${XDEBUG_ENABLE}" = "1" ]; then
44+
cp /usr/local/etc/php/conf.disabled/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
45+
else
46+
rm -f /usr/local/etc/php/conf.d/xdebug.ini || true
47+
fi
48+
49+
if [ "${LDAP_ENABLE}" = "0" ]; then
50+
rm -f /usr/local/etc/php/conf.d/docker-php-ext-ldap.ini || true
51+
fi
52+
53+
if [ "${APCU_ENABLE}" = "1" ]; then
54+
cp /usr/local/etc/php/conf.disabled/apcu.ini /usr/local/etc/php/conf.d/apcu.ini
55+
else
56+
rm -f /usr/local/etc/php/conf.d/apcu.ini || true
57+
fi
58+
59+
# php-fpm template env subst.
60+
envsubst </templates/zz2-docker-custom.conf >/usr/local/etc/php-fpm.d/zz2-docker-custom.conf
61+
62+
# If the environment is not local, we enable structured logging.
63+
if [ "${ENV:-}" != "loc" ]; then
64+
envsubst </templates/zz3-structured-logs.conf >/usr/local/etc/php-fpm.d/zz3-structured-logs.conf
65+
fi
66+
67+
exec "$@"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[www]
2+
pm = ${PHP_FPM_PM_TYPE}
3+
pm.max_children = ${PHP_FPM_MAX_CHILDREN}
4+
pm.start_servers = ${PHP_FPM_START_SERVERS}
5+
pm.min_spare_servers = ${PHP_FPM_MIN_SPARE_SERVERS}
6+
pm.max_spare_servers = ${PHP_FPM_MAX_SPARE_SERVERS}
7+
pm.status_path = ${PHP_FPM_PM_STATUS_PATH}
8+
access.format = '%{REMOTE_ADDR}e - %{WEBSERVER_REQUEST_ID}e - %t - %s "%m %r%Q%q" %{REQUEST_URI}e'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[www]
2+
access.format = '{"requestId": "%{WEBSERVER_REQUEST_ID}e", "status": %s, "time": "%t", "requestMethod": "%m", "requestUrl": "%r%Q%q", "requestUri": "%{REQUEST_URI}e", "remoteAddr": "%{REMOTE_ADDR}e", "http_x_forwarded_for": "%{X_FORWARDED_FOR}e", "proxy_add_x_forwarded_for": "%{ADD_X_FORWARDED_FOR}e"}';

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,18 @@ build-8-3-2: build-template
158158
build-8-3-2-rootless: PHPVER=8.3.2-fpm-alpine3.18
159159
build-8-3-2-rootless: build-rootless-template
160160

161+
build-8-3-15: PHPVER=8.3.15-fpm-alpine3.21
162+
build-8-3-15: build-template
163+
164+
build-8-3-15-rootless: PHPVER=8.3.15-fpm-alpine3.21
165+
build-8-3-15-rootless: build-rootless-template
166+
167+
build-8-4-2: PHPVER=8.4.2-fpm-alpine3.21
168+
build-8-4-2: build-template
169+
170+
build-8-4-2-rootless: PHPVER=8.4.2-fpm-alpine3.21
171+
build-8-4-2-rootless: build-rootless-template
172+
161173
build-template: guessing-folder build-test-image
162174
docker buildx build \
163175
--load \

scripts/guess_folder.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -u
55

66
# This script returns the base folder for the desired PHP version.
7-
# It tryes to find the corresponding folder in the filesystem, using this precedence:
7+
# It tries to find the corresponding folder in the filesystem, using this precedence:
88
# 1. full version name (e.g.: 7.4.29-fpm-alpine3.15)
99
# 2. full semver version (e.g.: 7.4.9)
1010
# 3. major.minor (e.g.: 7.4)

0 commit comments

Comments
 (0)