| # Build stage | |
| FROM golang:1.24-alpine AS builder | |
| RUN apk add --no-cache git | |
| WORKDIR /app | |
| COPY . . | |
| RUN go mod tidy | |
| RUN CGO_ENABLED=0 GOOS=linux go build -o huggingface-cc | |
| # Runtime stage | |
| FROM alpine:3.22.0 | |
| RUN apk add --no-cache \ | |
| git \ | |
| bash \ | |
| curl | |
| RUN adduser -D -u 1000 user | |
| USER user | |
| # Install Hugging Face CLI and transformers | |
| # RUN pip3 install --no-cache-dir --break-system-packages --user huggingface_hub transformers pytorch | |
| # Copy binary from builder | |
| COPY --chown=user:user --from=builder /app/huggingface-cc /usr/local/bin/ | |
| EXPOSE 8080 | |
| CMD ["huggingface-cc"] | |