From 04cf353d2b1e2b8fd0fb520ccfc1ad5e1d8cb9ec Mon Sep 17 00:00:00 2001 From: Max Ignatenko Date: Tue, 16 Dec 2025 23:03:20 +0000 Subject: [PATCH] Make better use of build cache Usually the point of copying go.mod and go.sum separately is to let `docker build` use cached `go mod download` layer. Copying in all other sources before `go mod download` defeats that purpose and would trigger a full download on every build if the code has changed. --- src/docs/guides/gin.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/docs/guides/gin.md b/src/docs/guides/gin.md index 23c2d9d47..dfe77baa9 100644 --- a/src/docs/guides/gin.md +++ b/src/docs/guides/gin.md @@ -68,12 +68,12 @@ width={2661} height={1019} quality={100} /> # Copy go mod and sum files COPY go.mod go.sum ./ - # Copy local code to the container image. - COPY . ./ - # Install project dependencies RUN go mod download + # Copy local code to the container image. + COPY . ./ + # Build the app RUN go build -o app