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
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:
@@ -1,51 +1,52 @@
|
|||||||
|
# Peikarband Platform - Woodpecker CI/CD Pipeline
|
||||||
|
# Harbor Registry: hub.peikarband.ir
|
||||||
|
# Best Practices Applied
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
build:
|
build:
|
||||||
image: docker:24-dind
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
environment:
|
settings:
|
||||||
DOCKER_BUILDKIT: 1
|
repo: hub.peikarband.ir/peikarband/landing
|
||||||
commands:
|
tags:
|
||||||
- echo "🔨 Building Docker image..."
|
- latest
|
||||||
- docker buildx create --use --name builder || true
|
- ${CI_COMMIT_SHA:0:8}
|
||||||
- docker buildx build \
|
dockerfile: Dockerfile
|
||||||
--platform linux/amd64 \
|
context: .
|
||||||
--build-arg VERSION=${CI_COMMIT_SHA:0:8} \
|
platforms: linux/amd64
|
||||||
--build-arg BUILD_DATE=${CI_PIPELINE_CREATED} \
|
build_args:
|
||||||
--build-arg PYTHON_VERSION=3.11 \
|
- VERSION=${CI_COMMIT_SHA:0:8}
|
||||||
--build-arg NODE_VERSION=20 \
|
- BUILD_DATE=${CI_PIPELINE_CREATED}
|
||||||
--label org.opencontainers.image.created=${CI_PIPELINE_CREATED} \
|
- PYTHON_VERSION=3.11
|
||||||
--label org.opencontainers.image.source=${CI_REPO_LINK} \
|
- NODE_VERSION=20
|
||||||
--label org.opencontainers.image.url=${CI_REPO_LINK} \
|
labels:
|
||||||
--label org.opencontainers.image.revision=${CI_COMMIT_SHA} \
|
- org.opencontainers.image.created=${CI_PIPELINE_CREATED}
|
||||||
--label org.opencontainers.image.version=${CI_COMMIT_SHA:0:8} \
|
- org.opencontainers.image.source=${CI_REPO_LINK}
|
||||||
--label org.opencontainers.image.title="Peikarband Landing" \
|
- org.opencontainers.image.url=${CI_REPO_LINK}
|
||||||
--label org.opencontainers.image.description="Peikarband hosting platform landing page" \
|
- org.opencontainers.image.revision=${CI_COMMIT_SHA}
|
||||||
--tag hub.peikarband.ir/peikarband/landing:${CI_COMMIT_SHA:0:8} \
|
- org.opencontainers.image.version=${CI_COMMIT_SHA:0:8}
|
||||||
--tag hub.peikarband.ir/peikarband/landing:latest \
|
- org.opencontainers.image.title=Peikarband Landing
|
||||||
--load \
|
- org.opencontainers.image.description=Peikarband hosting platform landing page
|
||||||
--file Dockerfile \
|
cache: inline
|
||||||
.
|
provenance: true
|
||||||
- echo "✅ Build completed"
|
push: false
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
timeout: 30m
|
timeout: 30m
|
||||||
when:
|
when:
|
||||||
event: [push, tag, manual]
|
event: [push, tag, manual]
|
||||||
|
|
||||||
push:
|
push:
|
||||||
image: docker:24-dind
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
environment:
|
settings:
|
||||||
DOCKER_BUILDKIT: 1
|
registry: hub.peikarband.ir
|
||||||
commands:
|
repo: hub.peikarband.ir/peikarband/landing
|
||||||
- echo "📤 Pushing Docker image..."
|
username:
|
||||||
- echo $${HARBOR_PASSWORD} | docker login hub.peikarband.ir -u $${HARBOR_USERNAME} --password-stdin
|
from_secret: HARBOR_USERNAME
|
||||||
- docker push hub.peikarband.ir/peikarband/landing:${CI_COMMIT_SHA:0:8}
|
password:
|
||||||
- docker push hub.peikarband.ir/peikarband/landing:latest
|
from_secret: HARBOR_PASSWORD
|
||||||
- echo "✅ Push completed"
|
tags:
|
||||||
secrets:
|
- latest
|
||||||
- HARBOR_USERNAME
|
- ${CI_COMMIT_SHA:0:8}
|
||||||
- HARBOR_PASSWORD
|
push: true
|
||||||
volumes:
|
insecure: false
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
timeout: 30m
|
||||||
timeout: 10m
|
|
||||||
when:
|
when:
|
||||||
event: [push, tag, manual]
|
event: [push, tag, manual]
|
||||||
|
|||||||
12
Dockerfile
12
Dockerfile
@@ -41,6 +41,17 @@ RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
|
|||||||
&& apt-get install -y --no-install-recommends nodejs \
|
&& apt-get install -y --no-install-recommends nodejs \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& 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 only requirements first (for better layer caching)
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|
||||||
@@ -53,6 +64,7 @@ COPY --chown=root:root . .
|
|||||||
|
|
||||||
# Build and export Reflex app for production
|
# Build and export Reflex app for production
|
||||||
# Export creates .web directory with frontend static files
|
# 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
|
RUN python -m reflex export --no-zip
|
||||||
|
|
||||||
# Aggressive cleanup to reduce layer size
|
# Aggressive cleanup to reduce layer size
|
||||||
|
|||||||
Reference in New Issue
Block a user