Skip to content

Dockerfile

Dockerfile

shell
# 构建阶段FROM 
golang:1.24.1 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 ubuntu:latest
WORKDIR /app
COPY --from=builder /app/main .
CMD ["./main"]
最近更新