Download Dockerfile from mikeapo/myidx: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/mikeapo/myidx/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/mikeapo/myidx/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/mikeapo/myidx/resolve/main/Dockerfile
1.22 kB
| # 使用超轻量级的 Debian 镜像作为基础 | |
| FROM debian:bookworm-slim | |
| # 避免安装时的交互提示,并设置语言环境 | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| LANG=zh_CN.UTF-8 \ | |
| LC_ALL=zh_CN.UTF-8 | |
| # 安装极简图形环境、VNC 服务、浏览器及中文字体 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| firefox-esr \ | |
| xvfb \ | |
| x11vnc \ | |
| novnc \ | |
| websockify \ | |
| fluxbox \ | |
| fonts-wqy-zenhei \ | |
| && apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # 解决强迫症:将 vnc.html 设置为默认首页,避免显示丑陋的目录列表 | |
| RUN cp /usr/share/novnc/vnc.html /usr/share/novnc/index.html | |
| # 避坑核心:创建 UID 为 1000 的普通用户以匹配 HF 的强制要求 | |
| RUN useradd -m -u 1000 hfuser | |
| USER hfuser | |
| WORKDIR /home/hfuser | |
| # 暴露 HF 唯一认可的端口 | |
| EXPOSE 7860 | |
| # 启动链条:启动虚拟屏幕 -> 启动窗口管理器 -> 启动火狐 -> 启动VNC -> 启动Web代理绑定7860 | |
| CMD Xvfb :99 -screen 0 1280x720x24 & \ | |
| sleep 1 && \ | |
| fluxbox -display :99 & \ | |
| firefox-esr --display=:99 & \ | |
| x11vnc -display :99 -nopw -listen localhost -xkb -forever & \ | |
| websockify --web /usr/share/novnc/ 7860 localhost:5900 |