feat: docker.

This commit is contained in:
2025-03-20 17:02:12 +08:00
parent 8911c6708a
commit 83f3c6e11f
2 changed files with 48 additions and 0 deletions

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
# 构建阶段
FROM golang:1.23-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
# 运行阶段
FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/main .
COPY config.yaml ./
EXPOSE 8080
CMD ["./main"]