Spaces:
Runtime error
Runtime error
| # ============================================================================== | |
| # Dockerfile for the Python/FastAPI Backend (Corrected) | |
| # ============================================================================== | |
| # Use an official Python runtime as a parent image | |
| FROM python:3.10-slim | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # --- Environment Variables --- | |
| ENV PYTHONDONTWRITEBYTECODE 1 | |
| ENV PYTHONUNBUFFERED 1 | |
| # --- Install Dependencies --- | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # --- Copy Application Code and Model --- | |
| COPY . . | |
| # --- Expose Port and Run Application --- | |
| EXPOSE 8000 | |
| # Command to run the application using python's module flag (-m) | |
| # This is a more robust way to run uvicorn inside a container. | |
| CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] | |