fix(docker): remove npm run build and fix PYTHONPATH | ApprovalToken: 1767140602
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Remove npm run build (reflex export already builds frontend) - Fix PYTHONPATH ENV to avoid undefined variable warning - Only install npm dependencies, don't run build script - Fixes 'Missing script: build' error
This commit is contained in:
@@ -50,16 +50,16 @@ RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
COPY peikarband/ .
|
||||
|
||||
# Set PYTHONPATH to include /build so Reflex can find the app
|
||||
ENV PYTHONPATH=/build:$PYTHONPATH
|
||||
ENV PYTHONPATH=/build
|
||||
|
||||
# Initialize Reflex and build frontend
|
||||
RUN reflex init --loglevel debug || true && \
|
||||
reflex export --frontend-only --no-zip --loglevel debug || echo "Export completed with warnings"
|
||||
|
||||
# Build frontend with npm (fallback if reflex export fails)
|
||||
# Check if .web directory exists and has package.json
|
||||
# Install npm dependencies if .web directory exists
|
||||
# Note: reflex export already builds the frontend, we just need to install deps
|
||||
RUN if [ -d "/build/.web" ] && [ -f "/build/.web/package.json" ]; then \
|
||||
echo "Found .web directory with package.json, building frontend..." && \
|
||||
echo "Found .web directory with package.json, installing dependencies..." && \
|
||||
cd /build/.web && \
|
||||
# Remove any existing .npmrc that might override registry
|
||||
rm -f .npmrc && \
|
||||
@@ -71,6 +71,7 @@ RUN if [ -d "/build/.web" ] && [ -f "/build/.web/package.json" ]; then \
|
||||
npm config set fetch-timeout 300000 && \
|
||||
# Verify registry is set correctly
|
||||
echo "Using npm registry: $(npm config get registry)" && \
|
||||
# Install dependencies (reflex export already built the frontend)
|
||||
if [ -f "package-lock.json" ]; then \
|
||||
npm ci --prefer-offline --no-audit --loglevel verbose || \
|
||||
(echo "npm ci failed, retrying with npm install..." && npm install --prefer-offline --no-audit --loglevel verbose); \
|
||||
@@ -78,9 +79,9 @@ RUN if [ -d "/build/.web" ] && [ -f "/build/.web/package.json" ]; then \
|
||||
echo "package-lock.json not found, using npm install..." && \
|
||||
npm install --prefer-offline --no-audit --loglevel verbose; \
|
||||
fi && \
|
||||
npm run build; \
|
||||
echo "Dependencies installed successfully"; \
|
||||
else \
|
||||
echo "Warning: .web directory or package.json not found, skipping npm build"; \
|
||||
echo "Warning: .web directory or package.json not found, skipping npm install"; \
|
||||
fi
|
||||
|
||||
# ============================================
|
||||
|
||||
Reference in New Issue
Block a user