# Use an official Python runtime FROM python:3.11-slim # Set the working directory WORKDIR /app # Install native libs needed for OpenCV / QR detection RUN apt-get update && apt-get install -y --no-install-recommends \ libzbar0 \ libgl1 \ libglib2.0-0 \ curl \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Runtime defaults ENV APP_ENV=prod ENV PORT=7860 ENV EXPOSE_DOCS=false ENV MAX_UPLOAD_MB=10 # Expose service port EXPOSE 7860 # Liveness probe target HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 CMD curl --fail http://127.0.0.1:7860/health || exit 1 # Run the app CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]