| 12345678910111213141516171819 |
- FROM golang:1.26-alpine AS builder
- RUN apk add --no-cache ca-certificates tzdata
- WORKDIR /app
- ENV GOTOOLCHAIN=auto
- ENV GOPROXY=https://goproxy.cn,https://goproxy.io,direct
- COPY go.mod go.sum ./
- RUN go mod download
- COPY internal/ internal/
- COPY cmd/ cmd/
- RUN GOMAXPROCS=2 CGO_ENABLED=0 GOOS=linux go build -p 2 -ldflags="-s -w" -o /app/server ./cmd/server
- FROM alpine:3.19
- RUN apk add --no-cache ca-certificates tzdata wget
- WORKDIR /app
- COPY --from=builder /app/server .
- COPY configs/ configs/
- ENV TZ=Asia/Shanghai
- EXPOSE 8080
- CMD ["./server"]
|