File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed
extensions/extensions-sdk/build Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -139,13 +139,16 @@ Example Dockerfile in `build/package/Dockerfile`
139139FROM golang:1.21.1-alpine as base-build
140140
141141WORKDIR /build
142- RUN go env -w GOMODCACHE=/root/.cache/go-build
143142
144- COPY go.mod go.sum ./
145- RUN --mount=type=cache,target=/root/.cache/go-build go mod download
143+ RUN --mount=type=cache,target=/go/pkg/mod \
144+ --mount=type=bind,source=go.mod,target=go.mod \
145+ --mount=type=bind,source=go.sum,target=go.sum \
146+ go mod download
146147
147- COPY ./src ./
148- RUN --mount=type=cache,target=/root/.cache/go-build go build -o /bin/app /build/src
148+ RUN --mount=type=cache,target=/go/pkg/mod \
149+ --mount=type=cache,target=/root/.cache/go-build \
150+ --mount=type=bind,target=. \
151+ go build -o /bin/app /build/src
149152...
150153` ` `
151154
Original file line number Diff line number Diff line change @@ -190,13 +190,13 @@ FROM node:17.7-alpine3.14 AS client-builder
190190FROM golang:1.17-alpine AS builder
191191ENV CGO_ENABLED=0
192192WORKDIR /backend
193- COPY vm/go.* .
194193RUN --mount=type=cache,target=/go/pkg/mod \
195- --mount=type=cache,target=/root/.cache/go-build \
194+ --mount=type=bind,source=vm/go.mod,target=go.mod \
195+ --mount=type=bind,source=vm/go.sum,target=go.sum \
196196 go mod download
197- COPY vm/. .
198197RUN --mount=type=cache,target=/go/pkg/mod \
199198 --mount=type=cache,target=/root/.cache/go-build \
199+ --mount=type=bind,source=vm/.,target=. \
200200 go build -trimpath -ldflags="-s -w" -o bin/service
201201
202202FROM alpine:3.15
Original file line number Diff line number Diff line change @@ -8,8 +8,9 @@ FROM golang:${GO_VERSION}-alpine AS base
88RUN apk add --no-cache openssl
99ENV CGO_ENABLED=0
1010WORKDIR /src
11- COPY go.mod go.sum ./
1211RUN --mount=type=cache,target=/go/pkg/mod \
12+ --mount=type=bind,source=go.mod,target=go.mod \
13+ --mount=type=bind,source=go.sum,target=go.sum \
1314 go mod download
1415
1516FROM base AS releaser
You can’t perform that action at this time.
0 commit comments