添加文件: xy_sh/Dockerfile.go

This commit is contained in:
renzhiyuan 2026-07-23 18:42:12 +08:00
parent ee9ecc0070
commit 4dd0d6aff2
1 changed files with 15 additions and 0 deletions

15
xy_sh/Dockerfile.go Normal file
View File

@ -0,0 +1,15 @@
dockerfile
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 /server ./cmd/server
FROM alpine:3.19
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
COPY --from=builder /server .
EXPOSE 8080
CMD ["./server"]