Download Dockerfile from sidaier/fc: direct link, hf CLI and curl.
- Browser
- Download file 1.35 kB
-
https://huggingface.co/spaces/sidaier/fc/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/sidaier/fc/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/sidaier/fc/resolve/main/Dockerfile
1.35 kB
| # 肆带贰球队系统 · Hugging Face Spaces 部署镜像(Docker SDK) | |
| FROM python:3.12-slim | |
| # 1) 中文字体:图片导出渲染中文名字必需。 | |
| # export_img.py 在 /usr/share/fonts 下直接找 NotoSansCJK-Regular.ttc, | |
| # 而 apt 会装到 .../opentype/noto/ 子目录,这里软链到代码期望的路径。 | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends fonts-noto-cjk \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && FONT="$(find /usr/share/fonts -iname 'NotoSansCJK*' -type f | head -1)" \ | |
| && if [ -n "$FONT" ]; then ln -sf "$FONT" /usr/share/fonts/NotoSansCJK-Regular.ttc; fi | |
| # 2) 安装 uv(与本地一致的包管理器) | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ | |
| # 3) HF Spaces 要求以非 root 用户(uid 1000)运行 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONUTF8=1 \ | |
| UV_COMPILE_BYTECODE=1 \ | |
| UV_LINK_MODE=copy | |
| WORKDIR /home/user/app | |
| # 4) 先装依赖(利用 Docker 层缓存;--no-dev 跳过 playwright 等开发依赖) | |
| COPY --chown=user pyproject.toml uv.lock ./ | |
| RUN uv sync --frozen --no-dev | |
| # 5) 拷贝应用代码 | |
| COPY --chown=user . . | |
| # 6) HF Spaces 默认端口 7860 | |
| EXPOSE 7860 | |
| CMD ["uv", "run", "--no-dev", "shiny", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"] | |