fix: install bun before reflex export to avoid network download failures
Some checks failed
CD - Build & Deploy / build-and-push (push) Has been cancelled
CD - Build & Deploy / package-helm (push) Has been cancelled
CD - Build & Deploy / deploy-staging (push) Has been cancelled
CD - Build & Deploy / deploy-production (push) Has been cancelled
CD - Build & Deploy / release (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / security (push) Has been cancelled
ci/woodpecker/manual/woodpecker Pipeline failed
ci/woodpecker/push/woodpecker Pipeline failed

- Pre-install bun with retry mechanism before reflex export
- Add bun to PATH to ensure reflex can find it
- Fixes connection reset errors during Docker build
This commit is contained in:
Ehsan.Asadi
2025-12-30 20:18:56 +03:30
parent ddc66884c0
commit 9154fd9216
2 changed files with 55 additions and 42 deletions

View File

@@ -41,6 +41,17 @@ RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install bun (required by Reflex for frontend build)
# Retry mechanism for network issues
RUN set -ex && \
for i in 1 2 3 4 5; do \
curl -fsSL https://bun.sh/install | bash && break || \
(echo "Attempt $i failed, retrying in 5 seconds..." && sleep 5); \
done || (echo "Failed to install bun after 5 attempts" && exit 1)
# Add bun to PATH
ENV PATH="/root/.bun/bin:${PATH}"
# Copy only requirements first (for better layer caching)
COPY requirements.txt .
@@ -53,6 +64,7 @@ COPY --chown=root:root . .
# Build and export Reflex app for production
# Export creates .web directory with frontend static files
# bun is now pre-installed, so reflex export won't try to download it
RUN python -m reflex export --no-zip
# Aggressive cleanup to reduce layer size