FROM python:3.11-slim WORKDIR /app ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ WEBUI_HOST=0.0.0.0 \ WEBUI_PORT=1455 \ LOG_LEVEL=info \ DEBUG=0 # 安装系统依赖 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ python3-dev \ libnss3 \ libatk-bridge2.0-0 \ libdrm2 \ libxkbcommon0 \ libgbm1 \ libasound2t64 \ libxshmfence1 \ libxcomposite1 \ libxdamage1 \ libxfixes3 \ libxrandr2 \ libx11-xcb1 \ libpango-1.0-0 \ libcairo2 \ fonts-liberation \ libdbus-1-3 \ libexpat1 \ libcups2t64 \ libxtst6 \ libxi6 \ libxext6 \ libxss1 \ unzip \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # 安装 Chromium 浏览器(从预下载的压缩包) COPY chrome-linux64.zip /tmp/chrome-linux64.zip RUN mkdir -p /opt/chromium && \ unzip -q /tmp/chrome-linux64.zip -d /opt/chromium && \ rm /tmp/chrome-linux64.zip && \ chmod +x /opt/chromium/chrome-linux64/chrome ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/opt/chromium/chrome-linux64/chrome COPY . . EXPOSE 1455 CMD ["python", "webui.py"]