Skip to content

Commit 8da0d47

Browse files
authored
Fix Dockerfile go dependency caching (#2626)
The current Dockerfile uses a bind mount when downloading the go dependencies. This causes the entire project folder to be added to the Docker context when only the `go.mod` and `go.sum` files are needed. This ends up breaking the caching of the dependencies as any change to any file in the project will cause the docker context to change. Removing this bind mount allows the dependencies to be correctly cached.
1 parent 12aea99 commit 8da0d47

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ COPY go.sum go.sum
88
# cache deps before building and copying source so that we don't need to re-download as much
99
# and so that source changes don't invalidate our downloaded layer
1010
RUN --mount=type=bind,target=. \
11-
--mount=type=cache,target=/root/.cache/go-build \
1211
GOPROXY=direct go mod download
1312

1413
FROM base AS build

0 commit comments

Comments
 (0)