国内镜像

This commit is contained in:
2026-06-09 21:53:24 +08:00
parent fbf31183ae
commit d5a28b11a3
+6 -2
View File
@@ -3,6 +3,7 @@
# ─── Stage 1: web build ───
FROM registry.jerryyan.top/library/node:22-alpine AS web
WORKDIR /web
RUN npm config set registry https://registry.npmmirror.com
COPY web/package.json web/pnpm-lock.yaml* ./
RUN corepack enable && (pnpm install --frozen-lockfile || pnpm install)
COPY web .
@@ -11,7 +12,9 @@ RUN pnpm build
# ─── Stage 2: go build ───
FROM registry.jerryyan.top/library/golang:1.25-alpine AS go
WORKDIR /src
RUN apk add --no-cache git
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk add --no-cache git
ENV GOPROXY=https://goproxy.cn,direct
COPY go.mod go.sum ./
RUN go mod download
COPY . .
@@ -20,7 +23,8 @@ RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags='-s -w' -o /out/server
# ─── Stage 3: runtime ───
FROM registry.jerryyan.top/library/alpine:3.20
RUN apk add --no-cache ca-certificates tzdata && \
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk add --no-cache ca-certificates tzdata && \
addgroup -S app && adduser -S app -G app
WORKDIR /app
COPY --from=go /out/server /app/server