build: 完善一键部署脚本

This commit is contained in:
2026-05-23 17:24:58 +08:00
parent bc5bb28b15
commit d236b5348a
4 changed files with 64 additions and 3 deletions
+4 -1
View File
@@ -1,9 +1,11 @@
# ---- Build Stage ----
FROM golang:1.26-alpine AS builder
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache git
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
RUN go env -w GOPROXY=https://goproxy.cn,direct && go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /bin/gen2d ./cmd/main.go
@@ -11,6 +13,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /bin/gen2d ./cmd/main.go
# ---- Runtime Stage ----
FROM alpine:3.20
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache ca-certificates
COPY --from=builder /bin/gen2d /usr/local/bin/gen2d