[DEPLOYMENT-001] Fix container structure to preserve peikarband.peikarband module path (fix) | ApprovalToken: AT-202512310616
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Ehsan.Asadi
2025-12-31 06:16:53 +03:30
parent 4ebc169079
commit dfa46aa4be
2 changed files with 10 additions and 9 deletions

View File

@@ -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 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
# Copy application code to /app/peikarband/ to create peikarband.peikarband structure
# With app_name="peikarband", Reflex expects to find peikarband.peikarband module
COPY --from=builder --chown=peikarband:peikarband /build/peikarband /app/peikarband
# Create necessary directories
RUN mkdir -p /app/data /app/logs /app/uploaded_files && \
@@ -144,14 +144,14 @@ RUN chmod -R 755 /app && \
# Environment variables
# PYTHONPATH=/app allows importing peikarband package from /app/peikarband/
# and src.* imports from /app/src/
# and peikarband.peikarband from /app/peikarband/peikarband/
# 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 \
PYTHONPATH=/app:/app/peikarband \
PATH="/app/.venv/bin:$PATH" \
REFLEX_DIR=/app \
REFLEX_DIR=/app/peikarband \
NODE_ENV=production
# Health check
@@ -168,8 +168,9 @@ EXPOSE 3000 8000
ENTRYPOINT ["/usr/bin/tini", "--"]
# Start application
# Reflex will run from /app where rxconfig.py is located
# PYTHONPATH=/app allows Python to find peikarband package for imports
# Reflex will run from /app/peikarband where rxconfig.py is located
# PYTHONPATH=/app:/app/peikarband allows Python to find both peikarband and peikarband.peikarband
WORKDIR /app/peikarband
CMD ["reflex", "run", "--env", "prod", "--loglevel", "info", "--frontend-port", "3000", "--backend-port", "8000"]
# ============================================