go-sys-dash / Dockerfile
3v324v23's picture
feat: enrich features and configure for huggingface
de65817
Raw
History Blame Contribute Delete
552 Bytes
# 构建阶段
FROM golang:1.21-alpine AS builder
WORKDIR /app
# 安装必要的构建依赖
RUN apk add --no-cache gcc musl-dev
# 复制依赖文件并下载
COPY go.mod go.sum ./
RUN go mod download
# 复制源代码并构建
COPY . .
RUN go build -o main .
# 运行阶段
FROM alpine:latest
WORKDIR /app
# 复制构建产物和静态资源
COPY --from=builder /app/main .
COPY --from=builder /app/static ./static
# 暴露端口 (Hugging Face Spaces 默认 7860)
EXPOSE 7860
# 设置环境变量
ENV PORT=7860
# 启动应用
CMD ["./main"]