FROM jlesage/firefox:latest ENV PORT=7860 ENV DISPLAY_WIDTH=1920 ENV DISPLAY_HEIGHT=1080 # ---------- 安装 ---------- RUN apk add --no-cache \ python3 \ py3-pip \ socat \ font-noto \ font-noto-cjk \ font-noto-cjk-extra # ---------- Python venv(PEP 668 解决方案) ---------- WORKDIR /app RUN python3 -m venv /app/venv ENV PATH="/app/venv/bin:$PATH" RUN pip install --upgrade pip \ && pip install fastapi uvicorn # ---------- FastAPI ---------- COPY clipboard_api.py /app/clipboard_api.py EXPOSE 7860 # ---------- 启动 ---------- CMD sh -c "\ # 1️⃣ 把 HF 的 7860 转发给 noVNC 的 5800 \ socat TCP-LISTEN:7860,fork TCP:127.0.0.1:5800 & \ \ # 2️⃣ FastAPI 只监听 localhost,不对外暴露 \ uvicorn clipboard_api:app --host 127.0.0.1 --port 8000 & \ \ # 3️⃣ 启动 Firefox/noVNC \ exec /init"