FROM python:3.12-slim

WORKDIR /app

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app/src

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    curl \
    libsndfile1 \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt ./
RUN pip install uv && \
    uv pip install --no-cache-dir --system -r requirements.txt

COPY src/ ./src/

RUN useradd -m -u 1000 agent && chown -R agent:agent /app
USER agent

EXPOSE 8000 18081

ENTRYPOINT ["python", "-m"]
