Download Dockerfile from pihn/asda: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/spaces/pihn/asda/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/pihn/asda/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/pihn/asda/resolve/main/Dockerfile
1.21 kB
| # ===== 阶段一:编译 CLIProxyAPI ===== | |
| FROM golang:1.26 AS builder | |
| WORKDIR /src | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git ca-certificates \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN git clone --depth=1 https://github.com/router-for-me/CLIProxyAPI.git . | |
| RUN go mod download | |
| RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o cli-proxy-api ./cmd/server | |
| # ===== 阶段二:运行环境 ===== | |
| FROM debian:bookworm-slim | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ca-certificates curl bash \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Hugging Face Docker Space 推荐使用 UID 1000 的非 root 用户 | |
| RUN useradd -m -u 1000 user | |
| # 给 /data 一个兜底权限;真正的 /data 挂载会在运行时出现 | |
| RUN mkdir -p /data && chmod 777 /data | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| COPY --from=builder --chown=user /src/cli-proxy-api $HOME/app/cli-proxy-api | |
| COPY --from=builder --chown=user /src/config.example.yaml $HOME/app/config.example.yaml | |
| COPY --chown=user start.sh $HOME/app/start.sh | |
| RUN chmod +x $HOME/app/cli-proxy-api $HOME/app/start.sh | |
| EXPOSE 7860 | |
| CMD ["./start.sh"] |