FROM python:3.12-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ curl \ libpq-dev \ chromium \ fonts-liberation fonts-ipafont-gothic fonts-wqy-zenhei fonts-freefont-ttf \ libasound2 libx11-6 libnss3 libxcomposite1 libxrandr2 libxdamage1 \ libxkbcommon0 libgtk-3-0 libdrm2 libgbm1 \ && rm -rf /var/lib/apt/lists/* COPY pyproject.toml uv.lock ./ # 配置 pip/uv 使用阿里云镜像,使用系统 Python ENV PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ ENV UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ ENV UV_PYTHON_PREFERENCE=system RUN pip install --no-cache-dir uv && \ uv sync --frozen --no-dev COPY . . # 安装 Playwright Chromium 浏览器(系统依赖已在上方 apt-get 中预装) RUN .venv/bin/python -m playwright install chromium RUN chmod +x entrypoint.sh ENTRYPOINT ["./entrypoint.sh"] EXPOSE 5000