浏览代码

build: Include go cache where module cache is used

Signed-off-by: Chris Crone <[email protected]>
Chris Crone 4 年之前
父节点
当前提交
d543ef3064
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Dockerfile

+ 3 - 0
Dockerfile

@@ -29,6 +29,7 @@ RUN apk add --no-cache -vv \
     protobuf-dev
     protobuf-dev
 COPY go.* .
 COPY go.* .
 RUN --mount=type=cache,target=/go/pkg/mod \
 RUN --mount=type=cache,target=/go/pkg/mod \
+    --mount=type=cache,target=/root/.cache/go-build \
     go mod download
     go mod download
 
 
 FROM base AS make-protos
 FROM base AS make-protos
@@ -58,6 +59,7 @@ RUN go get github.com/docker/import-restrictions
 FROM import-restrictions-base AS import-restrictions
 FROM import-restrictions-base AS import-restrictions
 RUN --mount=target=. \
 RUN --mount=target=. \
     --mount=type=cache,target=/go/pkg/mod \
     --mount=type=cache,target=/go/pkg/mod \
+    --mount=type=cache,target=/root/.cache/go-build \
     make -f builder.Makefile import-restrictions
     make -f builder.Makefile import-restrictions
 
 
 FROM base AS make-cli
 FROM base AS make-cli
@@ -113,6 +115,7 @@ RUN --mount=target=. \
 FROM base AS make-go-mod-tidy
 FROM base AS make-go-mod-tidy
 COPY . .
 COPY . .
 RUN --mount=type=cache,target=/go/pkg/mod \
 RUN --mount=type=cache,target=/go/pkg/mod \
+    --mount=type=cache,target=/root/.cache/go-build \
     go mod tidy
     go mod tidy
 
 
 FROM scratch AS go-mod-tidy
 FROM scratch AS go-mod-tidy