FROM python:3.11-slim # 设置工作目录 WORKDIR /app # 设置环境变量 ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 ENV PYTHONIOENCODING=utf-8 # 安装系统依赖 RUN apt-get update && apt-get install -y \ wget \ curl \ gnupg \ libnss3 \ libatk1.0-0 \ libatk-bridge2.0-0 \ libcups2 \ libdrm2 \ libxkbcommon0 \ libxcomposite1 \ libxdamage1 \ libxfixes3 \ libxrandr2 \ libgbm1 \ libasound2 \ libpango-1.0-0 \ libcairo2 \ libatspi2.0-0 \ fonts-noto-cjk \ fonts-noto-cjk-extra \ fonts-wqy-zenhei \ fonts-wqy-microhei \ fontconfig \ supervisor \ && rm -rf /var/lib/apt/lists/* \ && fc-cache -fv # 下载 wgcf(用于注册 WARP 并生成 WireGuard 配置) RUN wget -O /usr/local/bin/wgcf https://github.com/ViRb3/wgcf/releases/download/v2.2.22/wgcf_2.2.22_linux_amd64 \ && chmod +x /usr/local/bin/wgcf # 下载 wireproxy(用户空间 WireGuard 代理,无需 TUN) RUN wget -O /tmp/wireproxy.tar.gz https://github.com/pufferffish/wireproxy/releases/download/v1.0.9/wireproxy_linux_amd64.tar.gz \ && tar -xzf /tmp/wireproxy.tar.gz -C /usr/local/bin/ \ && chmod +x /usr/local/bin/wireproxy \ && rm /tmp/wireproxy.tar.gz # 安装 Python 依赖 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 安装 Playwright 浏览器 RUN playwright install chromium # 复制应用文件 COPY main.py . COPY config.json . COPY cookies.json* ./ COPY start.sh . COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf RUN chmod +x start.sh # 暴露端口 EXPOSE 7860 # 启动 CMD ["sh", "start.sh"]