1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

Merge pull request #1798 from marquiz/devel/docker-cache

Dockerfile: cache go modules on build
This commit is contained in:
Kubernetes Prow Robot 2024-07-18 09:14:03 -07:00 committed by GitHub
commit 51f2794d4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -11,7 +11,8 @@ COPY api/nfd/go.mod api/nfd/go.sum /go/node-feature-discovery/api/nfd/
WORKDIR /go/node-feature-discovery
RUN go mod download
RUN --mount=type=cache,target=/go/pkg/mod/ \
go mod download
# Do actual build
COPY . /go/node-feature-discovery
@ -19,7 +20,8 @@ COPY . /go/node-feature-discovery
ARG VERSION
ARG HOSTMOUNT_PREFIX
RUN make install VERSION=$VERSION HOSTMOUNT_PREFIX=$HOSTMOUNT_PREFIX
RUN --mount=type=cache,target=/go/pkg/mod/ \
make install VERSION=$VERSION HOSTMOUNT_PREFIX=$HOSTMOUNT_PREFIX
# Create full variant of the production image
FROM ${BASE_IMAGE_FULL} AS full

View file

@ -2,7 +2,8 @@ ARG BUILDER_IMAGE
FROM ${BUILDER_IMAGE} as builder
# Install tools
RUN go install github.com/vektra/mockery/v2@v2.42.0 && \
RUN --mount=type=cache,target=/go/pkg/mod/ \
go install github.com/vektra/mockery/v2@v2.42.0 && \
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0 && \
go install golang.org/x/tools/cmd/goimports@v0.11.0 && \
go install github.com/golang/protobuf/protoc-gen-go@v1.4.3