Spaces:
Sleeping
Sleeping
| # Dockerfile for the Backend API | |
| # 1. Start with a stable and widely-used Python version. | |
| # The 'bullseye' version is a specific release of Debian that has the libraries we need. | |
| FROM python:3.10-slim-bullseye | |
| # 2. Set the working directory inside the container. | |
| WORKDIR /code | |
| # 3. Update package lists and install the required system libraries for OpenCV. | |
| # This single command installs all necessary dependencies in one go. | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 4. Copy the requirements file and install Python dependencies. | |
| COPY ./requirements.txt /code/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # 5. Copy all your application files (backend_app.py, best.pt) into the container. | |
| COPY . /code/ | |
| # 6. The command that tells the server how to run your FastAPI app. | |
| CMD ["uvicorn", "backend_app:app", "--host", "0.0.0.0", "--port", "7860"] | |