Download Dockerfile from dss11/vsc2: direct link, hf CLI and curl.
- Browser
- Download file 7.27 kB
-
https://huggingface.co/spaces/dss11/vsc2/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/dss11/vsc2/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/dss11/vsc2/resolve/main/Dockerfile
7.27 kB
| FROM archlinux:latest | |
| RUN echo -e "[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf \ | |
| && echo -e "[archlinuxcn]\nServer = https://mirrors.aliyun.com/archlinuxcn/\$arch" >> /etc/pacman.conf \ | |
| && echo -e "[chaotic-aur]\nServer = https://geo-mirror.chaotic.cx/\$repo/\$arch" >> /etc/pacman.conf \ | |
| && echo -e "[atri]\nServer = https://repo.apeiria.net/\$arch" >> /etc/pacman.conf | |
| RUN pacman-key --init \ | |
| && pacman-key --lsign-key "farseerfc@archlinux.org" \ | |
| && pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com \ | |
| && pacman-key --lsign-key 3056513887B78AEB \ | |
| && pacman-key --recv-keys 293B93D8A471059F85D716A65BA92099D9BE2DAA \ | |
| && pacman-key --lsign-key 293B93D8A471059F85D716A65BA92099D9BE2DAA \ | |
| && pacman -Sy --noconfirm archlinuxcn-keyring | |
| RUN pacman -Syu --noconfirm yay | |
| RUN yay -S --noconfirm \ | |
| aria2 \ | |
| base-devel \ | |
| clang \ | |
| cmake \ | |
| cloudflared \ | |
| code-server \ | |
| code-server-marketplace \ | |
| curl \ | |
| deno \ | |
| direnv \ | |
| fisher \ | |
| fish \ | |
| gcc \ | |
| git \ | |
| git-lfs \ | |
| go \ | |
| intel-oneapi-basekit \ | |
| jq \ | |
| nginx \ | |
| nix \ | |
| nodejs \ | |
| openblas64 \ | |
| openssh \ | |
| p7zip \ | |
| pkgconf \ | |
| pkgfile \ | |
| pypy \ | |
| python \ | |
| python-pip \ | |
| ruff \ | |
| rust \ | |
| rye \ | |
| screen \ | |
| tinygo \ | |
| unzip \ | |
| uv \ | |
| uvx \ | |
| wget \ | |
| xmake \ | |
| zig \ | |
| zip \ | |
| && yay -Scc --noconfirm \ | |
| && rm -rf /var/cache/pacman/* | |
| RUN aria2c -c -x16 https://hf-mirror.com/hfd/hfd.sh \ | |
| && chmod a+x hfd.sh \ | |
| && mv hfd.sh /usr/bin/hfd | |
| RUN pkgfile --update | |
| RUN git lfs install | |
| RUN corepack prepare pnpm@latest \ | |
| && corepack enable pnpm | |
| COPY fish-oneapi /usr/bin/fish-oneapi | |
| RUN chmod +x /usr/bin/fish-oneapi | |
| # 创建符合 HF Spaces 要求的用户 (user ID 1000) | |
| RUN useradd -m -u 1000 user | |
| # 切换到用户 | |
| USER user | |
| # 设置工作目录 | |
| WORKDIR /home/user | |
| RUN mkdir -p /home/user/.ssh | |
| RUN plugins=( \ | |
| "danhper/fish-ssh-agent" \ | |
| "jethrokuan/z" \ | |
| "franciscolourenco/done" \ | |
| "jorgebucaran/autopair.fish" \ | |
| ) \ | |
| && for plugin in "${plugins[@]}"; do \ | |
| fish -c "fisher install $plugin"; \ | |
| done | |
| RUN rye toolchain register /usr/bin/python \ | |
| && rye toolchain register /usr/bin/pypy | |
| RUN fish -c 'SHELL=/usr/bin/fish pnpm setup' | |
| # 配置 code-server (HF Spaces 默认端口 7860) | |
| RUN mkdir -p /home/user/.config/code-server/ \ | |
| && touch /home/user/.config/code-server/config.yaml \ | |
| && echo -e "bind-addr: 0.0.0.0:7860\nauth: password\ncert: false" > /home/user/.config/code-server/config.yaml | |
| RUN extensions=( \ | |
| "aaron-bond.better-comments" \ | |
| "ahmadalli.vscode-nginx-conf" \ | |
| "alefragnani.bookmarks" \ | |
| "antfu.browse-lite" \ | |
| "antfu.vite" \ | |
| "arrterian.nix-env-selector" \ | |
| "bbenoist.nix" \ | |
| "bierner.lit-html" \ | |
| "christian-kohler.npm-intellisense" \ | |
| "christian-kohler.path-intellisense" \ | |
| "claui.packaging" \ | |
| "codezombiech.gitignore" \ | |
| "dart-code.dart-code" \ | |
| "dart-code.flutter" \ | |
| "davidanson.vscode-markdownlint" \ | |
| "dbaeumer.vscode-eslint" \ | |
| "denoland.vscode-deno" \ | |
| "donjayamanne.githistory" \ | |
| "eamodio.gitlens" \ | |
| "editorconfig.editorconfig" \ | |
| "esbenp.prettier-vscode" \ | |
| "fill-labs.dependi" \ | |
| "formulahendry.auto-close-tag" \ | |
| "formulahendry.auto-rename-tag" \ | |
| "gera2ld.markmap-vscode" \ | |
| "get-snippets.get-snippets" \ | |
| "github.codespaces" \ | |
| "github.remotehub" \ | |
| "github.vscode-github-actions" \ | |
| "golang.go" \ | |
| "graphql.vscode-graphql-syntax" \ | |
| "gruntfuggly.todo-tree" \ | |
| "jeff-hykin.better-dockerfile-syntax" \ | |
| "jnoortheen.nix-ide" \ | |
| "justjavac.vscode-deno-extensionpack" \ | |
| "laurencebahiirwa.deno-std-lib-snippets" \ | |
| "lit.lit-snippets" \ | |
| "matthewpi.caddyfile-support" \ | |
| "mechatroner.rainbow-csv" \ | |
| "mhutchie.git-graph" \ | |
| "mirone.milkdown" \ | |
| "misterj.vue-volar-extention-pack" \ | |
| "mkhl.direnv" \ | |
| "mrmlnc.vscode-json5" \ | |
| "ms-dotnettools.csdevkit" \ | |
| "ms-dotnettools.csharp" \ | |
| "ms-dotnettools.vscode-dotnet-runtime" \ | |
| "ms-dotnettools.vscodeintellicode-csharp" \ | |
| "ms-python.black-formatter" \ | |
| "ms-python.debugpy" \ | |
| "ms-python.python" \ | |
| "ms-python.vscode-pylance" \ | |
| "ms-toolsai.jupyter" \ | |
| "ms-toolsai.jupyter-keymap" \ | |
| "ms-toolsai.jupyter-renderers" \ | |
| "ms-toolsai.vscode-jupyter-cell-tags" \ | |
| "ms-toolsai.vscode-jupyter-slideshow" \ | |
| "ms-vscode.azure-repos" \ | |
| "ms-vscode.cmake-tools" \ | |
| "ms-vscode.cpptools" \ | |
| "ms-vscode.cpptools-extension-pack" \ | |
| "ms-vscode.cpptools-themes" \ | |
| "ms-vscode.remote-repositories" \ | |
| "msyrus.go-doc" \ | |
| "njpwerner.autodocstring" \ | |
| "oderwat.indent-rainbow" \ | |
| "pinage404.nix-extension-pack" \ | |
| "redhat.vscode-xml" \ | |
| "redhat.vscode-yaml" \ | |
| "rust-lang.rust-analyzer" \ | |
| "rxliuli.tsx" \ | |
| "sibiraj-s.vscode-scss-formatter" \ | |
| "swellaby.rust-pack" \ | |
| "syler.sass-indented" \ | |
| "tamasfe.even-better-toml" \ | |
| "timonwong.shellcheck" \ | |
| "twxs.cmake" \ | |
| "visualstudioexptteam.intellicode-api-usage-examples" \ | |
| "visualstudioexptteam.vscodeintellicode" \ | |
| "visualstudioexptteam.vscodeintellicode-completions" \ | |
| "vitaliymaz.vscode-svg-previewer" \ | |
| "vitest.explorer" \ | |
| "vue.volar" \ | |
| "wayou.vscode-todo-highlight" \ | |
| ) \ | |
| && for extension in "${extensions[@]}"; do \ | |
| code-server --config /home/user/.config/code-server/config.yaml --install-extension "$extension"; \ | |
| done | |
| RUN code-server --config /home/user/.config/code-server/config.yaml --uninstall-extension "serayuzgur.crates" | |
| # 切换回 root 用户进行系统配置 | |
| USER root | |
| # 配置 nginx (使用高端口,符合 HF Spaces 要求) | |
| RUN mkdir -p /var/www/html | |
| RUN echo '<html><head><title>Hello World</title></head><body><h1>Hello World</h1><p>Welcome to my server!</p></body></html>' > /var/www/html/index.html | |
| # 创建 nginx 配置 (监听端口 8080,符合 HF 要求) | |
| RUN mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled | |
| RUN echo 'server {\ | |
| listen 8080;\ | |
| server_name _;\ | |
| root /var/www/html;\ | |
| index index.html;\ | |
| \ | |
| location / {\ | |
| try_files $uri $uri/ =404;\ | |
| }\ | |
| \ | |
| # 隐藏的 VSCode 访问入口(通过 Cloudflare Tunnel 访问)\ | |
| location /admin-vscode {\ | |
| proxy_pass http://127.0.0.1:7860;\ | |
| proxy_set_header Host $host;\ | |
| proxy_set_header X-Real-IP $remote_addr;\ | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\ | |
| proxy_set_header X-Forwarded-Proto $scheme;\ | |
| }\ | |
| }' > /etc/nginx/sites-available/default | |
| RUN ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default | |
| # 给用户 nginx 权限 | |
| RUN mkdir -p /var/log/nginx /var/lib/nginx /run/nginx | |
| RUN chown -R user:user /var/www/html /var/log/nginx /var/lib/nginx /run/nginx 2>/dev/null || true | |
| RUN chmod -R 755 /var/www/html | |
| # 复制启动脚本 | |
| COPY start-services.sh /usr/bin/start-services.sh | |
| RUN chmod +x /usr/bin/start-services.sh | |
| # 验证脚本是否正确复制 | |
| RUN ls -la /usr/bin/start-services.sh | |
| # 切换回用户 | |
| USER user | |
| # 设置环境变量 | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| EXPOSE 7860 | |
| EXPOSE 8080 | |
| # 启动多服务脚本 | |
| CMD ["/usr/bin/start-services.sh"] |