diff --git a/Dockerfile b/Dockerfile index 6f4407ff..cfa6b133 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,19 +34,24 @@ FROM php:8.2-fpm-alpine AS runtime # System deps + PHP extensions. # pdo_mysql -> MariaDB, intl -> Symfony, opcache -> perf, redis -> Messenger/cache transport # -# Extensions are installed via mlocati/install-php-extensions, which fetches -# PREBUILT binaries instead of compiling from source. The previous approach -# (pecl install redis + docker-php-ext-install) compiled redis/intl/pdo_mysql -# on every build — minutes of CPU that intermittently overran Coolify's build -# timeout (exit 255). The prebuilt path is seconds and needs no .build-deps. +# IMPORTANT: the Coolify build host cannot reach pecl.php.net (the redis package +# registry) — both `pecl install redis` and install-php-extensions failed there +# with `No releases available for package "pecl.php.net/redis"`. So redis is +# built directly from its GitHub source tarball instead (github.com IS +# reachable). pdo_mysql/intl/opcache are bundled with PHP and need no network. +# retry() guards the apk/github fetches against transient mirror drops. +ENV PHPREDIS_VERSION=6.1.0 RUN set -eu; \ retry() { for i in 1 2 3 4 5; do "$@" && return 0; echo "retry $i: $*"; sleep 5; done; return 1; }; \ - retry apk add --no-cache nginx supervisor \ - && retry curl -sSLf https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \ - -o /usr/local/bin/install-php-extensions \ - && chmod +x /usr/local/bin/install-php-extensions \ - && install-php-extensions pdo_mysql intl opcache redis \ - && rm -f /usr/local/bin/install-php-extensions + retry apk add --no-cache nginx supervisor icu-libs \ + && retry apk add --no-cache --virtual .build-deps $PHPIZE_DEPS icu-dev \ + && docker-php-ext-install pdo_mysql intl opcache \ + && retry curl -sSLf "https://github.com/phpredis/phpredis/archive/refs/tags/${PHPREDIS_VERSION}.tar.gz" -o /tmp/phpredis.tar.gz \ + && mkdir -p /usr/src/php/ext/redis \ + && tar -xf /tmp/phpredis.tar.gz -C /usr/src/php/ext/redis --strip-components=1 \ + && docker-php-ext-install redis \ + && rm -rf /tmp/phpredis.tar.gz \ + && apk del .build-deps WORKDIR /app