# NOTE: This Dockerfile is for LOCAL Docker usage only.
# On HuggingFace Spaces, the Space uses sdk=gradio with ZeroGPU
# (see spaces/README.md) — this Dockerfile is NOT used there.
FROM python:3.11-slim

# System deps for audio/image processing that gradio may need
RUN apt-get update && apt-get install -y --no-install-recommends \
    ffmpeg libsndfile1 git \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Python deps first (cache layer)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy project
COPY . .

# Install the package itself (for obliteratus imports)
RUN pip install --no-cache-dir .

# Run as non-root user for security
RUN useradd -m appuser
USER appuser

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s \
  CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/')" || exit 1

CMD ["python", "app.py"]
