Skip to content

Commit ca68be7

Browse files
authored
Merge pull request #397 from jgehrcke/jp/invalidate-go-build-less-often
Invalidate go build cache layer less often
2 parents a8d4243 + 23ec7e3 commit ca68be7

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

.dockerignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
/deployments/container
1+
.dockerignore
2+
deployments/container
3+
*.tar
4+
*.tgz
5+
demo
6+
.git

deployments/container/Dockerfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# syntax=docker.io/docker/dockerfile:1.7-labs
2+
# The above enables the COPY --exclude flag, see:
3+
# https://github.com/moby/buildkit/pull/4561
4+
15
# Copyright (c) 2019-2025, NVIDIA CORPORATION. All rights reserved.
26
#
37
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,7 +50,16 @@ ENV GOPATH=/go
4650
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
4751

4852
WORKDIR /build
49-
COPY . .
53+
54+
# Copy everything that is needed for the go build, but do not invalidate go
55+
# build artifact layer unnecessarily often. Note that --exclude only affects the
56+
# cache.
57+
COPY --exclude=./templates/** \
58+
--exclude=./deployments/helm/** \
59+
--exclude=./hack/kubelet-plugin-prestart.sh \
60+
--exclude=./demo/** \
61+
--exclude=./Dockerfile \
62+
. .
5063

5164
RUN mkdir /artifacts
5265

@@ -96,3 +109,4 @@ COPY --from=build /artifacts/compute-domain-daemon /usr/bin/compute-do
96109
COPY --from=build /artifacts/gpu-kubelet-plugin /usr/bin/gpu-kubelet-plugin
97110
COPY --from=build /build/hack/kubelet-plugin-prestart.sh /usr/bin/kubelet-plugin-prestart.sh
98111
COPY --from=build /build/templates /templates
112+
COPY /templates /templates

deployments/container/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ $(IMAGE_TARGETS): image-%:
8787
--build-arg TOOLKIT_CONTAINER_IMAGE="$(TOOLKIT_CONTAINER_IMAGE)" \
8888
--build-arg VERSION="$(VERSION)" \
8989
--build-arg GIT_COMMIT="$(GIT_COMMIT)" \
90+
--progress=plain \
9091
-f $(DOCKERFILE) \
9192
$(CURDIR)
9293

0 commit comments

Comments
 (0)