From f3ab23e0c3b259480decb04d4a6c5172c2a1ed1e Mon Sep 17 00:00:00 2001 From: ay095411 <32893510+ay095411@users.noreply.github.com> Date: Thu, 24 Sep 2026 06:33:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(docker):=20=E5=9C=A8=20go=20mod=20download?= =?UTF-8?q?=20=E5=89=8D=E5=A4=8D=E5=88=B6=E6=9C=AC=E5=9C=B0=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E4=BE=9D=E8=B5=96=20(#610)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ddcat666 <26564566+ddcat666@users.noreply.github.com> --- backend/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/Dockerfile b/backend/Dockerfile index b98a7ee32..227dbda65 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -40,6 +40,11 @@ RUN apk add --no-cache build-base WORKDIR /src/backend COPY backend/go.mod backend/go.sum ./ +# go.mod 含本地 replace(github.com/casdoor/go-sms-sender => ./third_party/go-sms-sender)。 +# go mod download 解析依赖时就需要读到该目录的 go.mod,而这行执行时完整源码尚未复制, +# 缺了它会报 "reading third_party/go-sms-sender/go.mod: no such file or directory"。 +# 后面 COPY backend ./ 会覆盖为完整源码,这里只为让依赖解析通过。 +COPY backend/third_party ./third_party # 模块保留在普通镜像层中,供后续编译及跨 Runner 的 GHA 层缓存复用。 RUN go mod download COPY backend ./