fix(docker): retry composer install + source fallback for flaky GitHub on Coolify
Coolify build host intermittently gets HTTP 400 from codeload.github.com on Composer dist downloads. Bump COMPOSER_HTTP_RETRIES, wrap the install in a 5x retry loop, and on final attempt fall back to --prefer-source (git clone, different endpoint than dist zips). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+18
-4
@@ -7,10 +7,24 @@ FROM composer:2 AS vendor
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY composer.json composer.lock symfony.lock ./
|
COPY composer.json composer.lock symfony.lock ./
|
||||||
# --no-scripts: the Symfony kernel isn't fully copied yet; scripts run later in entrypoint.
|
# --no-scripts: the Symfony kernel isn't fully copied yet; scripts run later in entrypoint.
|
||||||
RUN composer install \
|
#
|
||||||
--no-dev --no-scripts --no-interaction \
|
# The Coolify build host intermittently gets HTTP 400 from codeload.github.com
|
||||||
--prefer-dist --optimize-autoloader \
|
# when Composer pulls dist zips. Mitigations:
|
||||||
--ignore-platform-reqs
|
# - bump Composer's own HTTP retry count
|
||||||
|
# - wrap the whole install in a retry loop
|
||||||
|
# - on the final attempt, fall back to --prefer-source (git clone) which uses
|
||||||
|
# a different endpoint than codeload dist zips
|
||||||
|
ENV COMPOSER_HTTP_RETRIES=5
|
||||||
|
RUN set -eu; \
|
||||||
|
for i in 1 2 3 4 5; do \
|
||||||
|
composer install --no-dev --no-scripts --no-interaction \
|
||||||
|
--prefer-dist --optimize-autoloader --ignore-platform-reqs && exit 0; \
|
||||||
|
echo "composer install failed (attempt $i) — retrying in 5s"; \
|
||||||
|
sleep 5; \
|
||||||
|
done; \
|
||||||
|
echo "dist download kept failing — final attempt via --prefer-source"; \
|
||||||
|
composer install --no-dev --no-scripts --no-interaction \
|
||||||
|
--prefer-source --optimize-autoloader --ignore-platform-reqs
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# Stage 2 — Frontend assets (Webpack Encore / React 19)
|
# Stage 2 — Frontend assets (Webpack Encore / React 19)
|
||||||
|
|||||||
Reference in New Issue
Block a user