mirror of
https://github.com/docker/compose.git
synced 2025-07-23 05:34:36 +02:00
build: Use BuildKit cache for modules
Signed-off-by: Chris Crone <christopher.crone@docker.com>
This commit is contained in:
parent
d2a4645e7d
commit
5aa14ef911
@ -28,7 +28,8 @@ RUN apk add --no-cache \
|
|||||||
protoc \
|
protoc \
|
||||||
protobuf-dev
|
protobuf-dev
|
||||||
COPY go.* .
|
COPY go.* .
|
||||||
RUN go mod download
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||||
|
go mod download
|
||||||
|
|
||||||
FROM base AS make-protos
|
FROM base AS make-protos
|
||||||
RUN go get github.com/golang/protobuf/protoc-gen-go@v1.4.1
|
RUN go get github.com/golang/protobuf/protoc-gen-go@v1.4.1
|
||||||
@ -42,6 +43,7 @@ ENV CGO_ENABLED=0
|
|||||||
COPY --from=lint-base /usr/bin/golangci-lint /usr/bin/golangci-lint
|
COPY --from=lint-base /usr/bin/golangci-lint /usr/bin/golangci-lint
|
||||||
ARG GIT_TAG
|
ARG GIT_TAG
|
||||||
RUN --mount=target=. \
|
RUN --mount=target=. \
|
||||||
|
--mount=type=cache,target=/go/pkg/mod \
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
--mount=type=cache,target=/root/.cache/go-build \
|
||||||
--mount=type=cache,target=/root/.cache/golangci-lint \
|
--mount=type=cache,target=/root/.cache/golangci-lint \
|
||||||
GIT_TAG=${GIT_TAG} \
|
GIT_TAG=${GIT_TAG} \
|
||||||
@ -52,6 +54,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 \
|
||||||
make -f builder.Makefile import-restrictions
|
make -f builder.Makefile import-restrictions
|
||||||
|
|
||||||
FROM base AS make-cli
|
FROM base AS make-cli
|
||||||
@ -61,6 +64,7 @@ ARG TARGETARCH
|
|||||||
ARG BUILD_TAGS
|
ARG BUILD_TAGS
|
||||||
ARG GIT_TAG
|
ARG GIT_TAG
|
||||||
RUN --mount=target=. \
|
RUN --mount=target=. \
|
||||||
|
--mount=type=cache,target=/go/pkg/mod \
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
--mount=type=cache,target=/root/.cache/go-build \
|
||||||
GOOS=${TARGETOS} \
|
GOOS=${TARGETOS} \
|
||||||
GOARCH=${TARGETARCH} \
|
GOARCH=${TARGETARCH} \
|
||||||
@ -72,6 +76,7 @@ FROM base AS make-cross
|
|||||||
ARG BUILD_TAGS
|
ARG BUILD_TAGS
|
||||||
ARG GIT_TAG
|
ARG GIT_TAG
|
||||||
RUN --mount=target=. \
|
RUN --mount=target=. \
|
||||||
|
--mount=type=cache,target=/go/pkg/mod \
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
--mount=type=cache,target=/root/.cache/go-build \
|
||||||
BUILD_TAGS=${BUILD_TAGS} \
|
BUILD_TAGS=${BUILD_TAGS} \
|
||||||
GIT_TAG=${GIT_TAG} \
|
GIT_TAG=${GIT_TAG} \
|
||||||
@ -91,6 +96,7 @@ ENV CGO_ENABLED=0
|
|||||||
ARG BUILD_TAGS
|
ARG BUILD_TAGS
|
||||||
ARG GIT_TAG
|
ARG GIT_TAG
|
||||||
RUN --mount=target=. \
|
RUN --mount=target=. \
|
||||||
|
--mount=type=cache,target=/go/pkg/mod \
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
--mount=type=cache,target=/root/.cache/go-build \
|
||||||
BUILD_TAGS=${BUILD_TAGS} \
|
BUILD_TAGS=${BUILD_TAGS} \
|
||||||
GIT_TAG=${GIT_TAG} \
|
GIT_TAG=${GIT_TAG} \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user