[DEPLOYMENT-001] Fix ModuleNotFoundError and rxconfig.py not found in container (fix) | ApprovalToken: AT-202512310556
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
@@ -130,9 +130,9 @@ WORKDIR /app
|
||||
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
|
||||
COPY --from=builder /usr/local/bin /usr/local/bin
|
||||
|
||||
# Copy application code to /app/peikarband/ to preserve package structure
|
||||
# Copy application code directly to /app/ to preserve package structure
|
||||
# This ensures peikarband.peikarband module can be found by Reflex
|
||||
COPY --from=builder --chown=peikarband:peikarband /build/peikarband /app/peikarband
|
||||
COPY --from=builder --chown=peikarband:peikarband /build/peikarband /app
|
||||
|
||||
# Create necessary directories
|
||||
RUN mkdir -p /app/data /app/logs /app/uploaded_files && \
|
||||
@@ -143,15 +143,15 @@ RUN chmod -R 755 /app && \
|
||||
chmod -R 777 /app/data /app/logs /app/uploaded_files
|
||||
|
||||
# Environment variables
|
||||
# PYTHONPATH=/app allows importing peikarband package from /app/peikarband
|
||||
# PYTHONPATH also includes /app/peikarband for src.* imports
|
||||
# PYTHONPATH=/app allows importing peikarband package from /app/peikarband/
|
||||
# and src.* imports from /app/src/
|
||||
# Note: Python adds current directory (.) to sys.path automatically, but PYTHONPATH entries come first
|
||||
# REFLEX_DIR points to the directory containing rxconfig.py
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONPATH=/app:/app/peikarband \
|
||||
PYTHONPATH=/app \
|
||||
PATH="/app/.venv/bin:$PATH" \
|
||||
REFLEX_DIR=/app/peikarband \
|
||||
REFLEX_DIR=/app \
|
||||
NODE_ENV=production
|
||||
|
||||
# Health check
|
||||
@@ -168,9 +168,8 @@ EXPOSE 3000 8000
|
||||
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||
|
||||
# Start application
|
||||
# We need to run from /app/peikarband so Reflex can find rxconfig.py
|
||||
# Reflex will run from /app where rxconfig.py is located
|
||||
# PYTHONPATH=/app allows Python to find peikarband package for imports
|
||||
WORKDIR /app/peikarband
|
||||
CMD ["reflex", "run", "--env", "prod", "--loglevel", "info", "--frontend-port", "3000", "--backend-port", "8000"]
|
||||
|
||||
# ============================================
|
||||
|
||||
Reference in New Issue
Block a user