ci: 添加国内镜像代理和 BuildKit 缓存优化构建速度 #84

Merged
huanghaosheng merged 2 commits from develop into main 2026-06-14 15:15:13 +08:00
3 changed files with 8 additions and 1 deletions
Showing only changes of commit 9379d3ef82 - Show all commits

View File

@@ -3,6 +3,9 @@ FROM golang:1.26-alpine AS builder
WORKDIR /app
# 使用国内 Go 代理
ENV GOPROXY=https://goproxy.cn,https://goproxy.io,direct
# 先复制依赖清单,利用 Docker 缓存层
COPY go.mod go.sum ./
RUN go mod download

View File

@@ -12,7 +12,8 @@ info() { echo -e "${GREEN}[INFO]${NC} $*"; }
cmd_build() {
info "构建 Docker 镜像..."
docker compose build
# 启用 BuildKit 加速构建
DOCKER_BUILDKIT=1 docker compose build --parallel
info "构建完成"
}

View File

@@ -3,6 +3,9 @@ FROM node:22-alpine AS builder
WORKDIR /app
# 使用国内 npm 镜像
RUN npm config set registry https://registry.npmmirror.com
# 先复制依赖清单,利用 Docker 缓存层
COPY package.json package-lock.json ./
RUN npm ci