build: 完善一键部署脚本
This commit is contained in:
+4
-1
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user