FROM python:3.12-slim

WORKDIR /wechat-bot

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

# 安装 Python 依赖（利用 Docker 层缓存）
COPY requirements.txt .
RUN pip install --no-cache-dir --break-system-packages -r requirements.txt

# 复制项目代码
COPY config.py .
COPY main.py .
COPY bot/ ./bot/

# 环境变量
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

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