Download Dockerfile from nbmhd/mhdbit: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/nbmhd/mhdbit/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/nbmhd/mhdbit/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/nbmhd/mhdbit/resolve/main/Dockerfile
1.11 kB
| # Build stage | |
| FROM golang:1.24-alpine AS builder | |
| # Set working directory for the build | |
| WORKDIR /app | |
| # Copy module files first to leverage Docker cache | |
| COPY go.mod go.sum ./ | |
| RUN go mod download | |
| # Copy all source files including client directory | |
| COPY . . | |
| # Build the Go app with static linking | |
| RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o main . | |
| # Final stage | |
| FROM alpine:3.18 | |
| RUN apk --no-cache add ca-certificates | |
| # Add a non-root user (UID/GID 1000, Hugging Face 默认用户) | |
| RUN addgroup -g 1000 user && adduser -D -u 1000 -G user user | |
| # ARG APP_VERSION, will be set during build by github actions | |
| ARG APP_VERSION=0.0.0 | |
| LABEL app.version=$APP_VERSION | |
| # Set working directory in final image | |
| WORKDIR /app | |
| # Create config directory and give permissions | |
| RUN mkdir -p /app/config && chown -R user:user /app | |
| # Use non-root user | |
| USER user | |
| # Copy the compiled binary from builder | |
| COPY --from=builder /app/main . | |
| # Copy client directory from builder | |
| COPY --from=builder /app/client ./client/ | |
| # Expose the port your app runs on | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["/app/main"] |