From cb0c7471333da1443b9007a8746862e0715767cc Mon Sep 17 00:00:00 2001 From: hhs <386998068@qq.com> Date: Sun, 14 Jun 2026 15:14:28 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E5=9B=BD=E5=86=85?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E4=BB=A3=E7=90=86=E5=92=8C=20BuildKit=20?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=BC=98=E5=8C=96=E6=9E=84=E5=BB=BA=E9=80=9F?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/Dockerfile | 3 +++ deploy.sh | 3 ++- frontend/Dockerfile | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 67bd3f3..7036eb6 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -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 diff --git a/deploy.sh b/deploy.sh index f8421f6..7c786aa 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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 "构建完成" } diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 2e72310..8a66c0a 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -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