Spaces:
Runtime error
Runtime error
| # Use Python 3.10 slim image for a smaller footprint | |
| FROM python:3.10-slim | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy requirements first to leverage Docker cache | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Download the spaCy model | |
| RUN python -m spacy download en_core_web_sm | |
| # Copy the rest of the application code | |
| COPY . . | |
| # Expose ports for FastAPI and Streamlit | |
| EXPOSE 8000 8501 | |
| # Define environment variable for Streamlit to find the backend | |
| ENV BACKEND_URL="http://localhost:8000" | |
| # Create a startup script to run both services | |
| RUN echo '#!/bin/bash' > /app/start.sh && \ | |
| echo 'set -e' >> /app/start.sh && \ | |
| echo 'uvicorn app:create_app --host 0.0.0.0 --port 8000 &' >> /app/start.sh && \ | |
| echo 'sleep 10' >> /app/start.sh && \ | |
| echo 'streamlit run streamlit_app.py --server.port 8501 --server.address 0.0.0.0 --server.enableCORS=false' >> /app/start.sh | |
| RUN chmod +x /app/start.sh | |
| # Run the startup script | |
| CMD ["/app/start.sh"] | |