# Use a single official Python runtime FROM python:3.9-slim # Set working directory to /app WORKDIR /app # 1. Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # 2. Copy requirements and install python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Ensure explicit install of both frameworks RUN pip install --no-cache-dir streamlit requests pandas plotly uvicorn fastapi # 3. Copy the entire project code COPY . . # 4. Expose the specific port Hugging Face requires EXPOSE 7860 # 5. COMMAND: Run Both Services with a DELAY # We added "sleep 5" to give the API time to start before the UI launches. CMD ["/bin/bash", "-c", "uvicorn app.main:app --host 0.0.0.0 --port 8000 & sleep 5 && streamlit run frontend/ui.py --server.port 7860 --server.address 0.0.0.0"]