# Use an official Python runtime as a parent image FROM python:3.10-slim # Set environment variables ENV PYTHONUNBUFFERED 1 # Set the port Uvicorn will listen on ENV PORT 8000 # Set the working directory in the container WORKDIR /app # Install system dependencies needed by some Python packages (e.g., OpenCV) RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir -r requirements.txt COPY . /app RUN python -c "import depth_texture_mask; depth_texture_mask.init_midas()" # Expose the port EXPOSE ${PORT} # Run using uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]