ci: Dockerfile 换国内源加速构建
- npm 用 npmmirror(淘宝源),go 用 goproxy.cn - 大幅缩短 132 上 npm ci / go mod download 耗时 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -2,20 +2,21 @@
|
|||||||
FROM node:20-alpine AS web
|
FROM node:20-alpine AS web
|
||||||
WORKDIR /app/web
|
WORKDIR /app/web
|
||||||
COPY web/package*.json ./
|
COPY web/package*.json ./
|
||||||
RUN npm ci
|
RUN npm config set registry https://registry.npmmirror.com && npm ci
|
||||||
COPY web/ ./
|
COPY web/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine AS admin
|
FROM node:20-alpine AS admin
|
||||||
WORKDIR /app/admin
|
WORKDIR /app/admin
|
||||||
COPY admin/package*.json ./
|
COPY admin/package*.json ./
|
||||||
RUN npm ci
|
RUN npm config set registry https://registry.npmmirror.com && npm ci
|
||||||
COPY admin/ ./
|
COPY admin/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# ── 2. 编译 Go(embed 两份前端产物)──
|
# ── 2. 编译 Go(embed 两份前端产物)──
|
||||||
FROM golang:1.26-alpine AS server
|
FROM golang:1.26-alpine AS server
|
||||||
WORKDIR /app/server
|
WORKDIR /app/server
|
||||||
|
ENV GOPROXY=https://goproxy.cn,direct
|
||||||
COPY server/go.mod server/go.sum ./
|
COPY server/go.mod server/go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY server/ ./
|
COPY server/ ./
|
||||||
|
|||||||
Reference in New Issue
Block a user