perf(docker): parallel ext compile (MAKEFLAGS=-j) to beat Coolify build timeout

Coolify builds with --no-cache, so intl (C++) recompiles from source every
deploy (~180s single-threaded) and overran the build timeout (exit 255).
Compile across all cores via MAKEFLAGS=-j$(nproc) to cut it several-fold.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-28 15:38:10 +03:30
co-authored by Claude Opus 4.8
parent cb401c6dbf
commit 5f557b2c57
+5
View File
@@ -54,8 +54,13 @@ FROM php:8.2-fpm-alpine AS runtime
# 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.
#
# intl is C++ and slow to compile; Coolify builds with --no-cache so it recompiles
# every deploy and was overrunning the build timeout (exit 255). Compile in
# parallel across all cores (MAKEFLAGS=-j$(nproc)) to cut that time several-fold.
ENV PHPREDIS_VERSION=6.1.0
RUN set -eu; \
export MAKEFLAGS="-j$(nproc)"; \
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 icu-libs \
&& retry apk add --no-cache --virtual .build-deps $PHPIZE_DEPS icu-dev \