diff --git a/docker/Dockerfile b/docker/Dockerfile index 5fb77b6..2b064ca 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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"] # ============================================ diff --git a/peikarband/rxconfig.py b/peikarband/rxconfig.py index be00ed0..95486f8 100644 --- a/peikarband/rxconfig.py +++ b/peikarband/rxconfig.py @@ -13,7 +13,7 @@ BACKEND_PORT = int(os.getenv("BACKEND_PORT", "8000")) DB_URL = os.getenv("DATABASE_URL", "sqlite:////app/data/reflex.db") config = rx.Config( - app_name="app", + app_name="peikarband", api_url=API_URL, frontend_port=FRONTEND_PORT, backend_port=BACKEND_PORT,