FROM python:3.11-slim

WORKDIR /app

# 安装系统依赖
RUN apt-get update && apt-get install -y \
    curl \
    wget \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

# 复制依赖并安装
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 复制应用代码
COPY agent.py .
COPY .env* ./

EXPOSE 8640

HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
    CMD curl -f http://localhost:8640/health || exit 1

CMD ["livekit-agents", "start", "-r", "http://livekit-server:7880", "-k", "devkey", "-s", "secret", "--worker-entrypoint", "entrypoint"]
