-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathMakefile
More file actions
342 lines (291 loc) · 15.9 KB
/
Copy pathMakefile
File metadata and controls
342 lines (291 loc) · 15.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
BUILD_MULTI_ARCH_IMAGES ?= no
DOCKER ?= docker
BUILDX =
ifeq ($(BUILD_MULTI_ARCH_IMAGES), true)
BUILDX = buildx
endif
##### Global variables #####
include $(CURDIR)/versions.mk
ifeq ($(IMAGE_NAME),)
REGISTRY ?= nvidia
IMAGE_NAME := $(REGISTRY)/driver
endif
DRIVER_TAG = $(DRIVER_VERSION)
# VERSION indicates the version to tag the image with.
# Production tags should be in the form <driver-version>-<dist>
# Development tags should be in the form <commit-sha>-<driver-version>-<dist>
ifeq ($(VERSION),)
IMAGE_VERSION = $(DRIVER_TAG)
else
IMAGE_VERSION = $(VERSION)-$(DRIVER_TAG)
endif
IMAGE_TAG = $(IMAGE_VERSION)-$(DIST)
IMAGE = $(IMAGE_NAME):$(IMAGE_TAG)
OUT_IMAGE_NAME ?= $(IMAGE_NAME)
ifeq ($(OUT_VERSION),)
OUT_IMAGE_VERSION = $(DRIVER_TAG)
else
OUT_IMAGE_VERSION = $(OUT_VERSION)-$(DRIVER_TAG)
endif
OUT_DIST ?= $(DIST)
OUT_IMAGE_TAG = $(OUT_IMAGE_VERSION)-$(OUT_DIST)
OUT_IMAGE = $(OUT_IMAGE_NAME):$(OUT_IMAGE_TAG)
##### Public rules #####
DISTRIBUTIONS := ubuntu22.04 ubuntu24.04 ubuntu26.04 signed_ubuntu22.04 signed_ubuntu24.04 signed_ubuntu26.04 rhel8 rhel9 rhel10 rocky8 rocky9 rocky10 precompiled_rhcos
RHCOS_VERSIONS := rhcos4.18 rhel9.6 rhel9.8
PUSH_TARGETS := $(patsubst %, push-%, $(DISTRIBUTIONS))
BASE_FROM := resolute noble jammy
PUSH_TARGETS := $(patsubst %, push-%, $(DISTRIBUTIONS))
VGPU_GUEST_DRIVER_PUSH_TARGETS := $(patsubst %, push-vgpuguest-%, $(DISTRIBUTIONS) $(RHCOS_VERSIONS))
VGPU_HOST_DRIVER_PUSH_TARGETS := $(patsubst %, push-vgpuhost-%, $(DISTRIBUTIONS) $(RHCOS_VERSIONS))
DRIVER_PUSH_TARGETS := $(foreach push_target, $(PUSH_TARGETS), $(addprefix $(push_target)-, $(DRIVER_VERSIONS)))
BUILD_TARGETS := $(patsubst %, build-%, $(DISTRIBUTIONS))
DRIVER_BUILD_TARGETS := $(foreach build_target, $(BUILD_TARGETS), $(addprefix $(build_target)-, $(DRIVER_VERSIONS)))
VGPU_GUEST_DRIVER_BUILD_TARGETS := $(patsubst %, build-vgpuguest-%, $(DISTRIBUTIONS) $(RHCOS_VERSIONS))
VGPU_HOST_DRIVER_BUILD_TARGETS := $(patsubst %, build-vgpuhost-%, $(DISTRIBUTIONS) $(RHCOS_VERSIONS))
TEST_TARGETS := $(patsubst %, test-%, $(DISTRIBUTIONS))
PULL_TARGETS := $(patsubst %, pull-%, $(DISTRIBUTIONS))
DRIVER_PULL_TARGETS := $(foreach pull_target, $(PULL_TARGETS), $(addprefix $(pull_target)-, $(DRIVER_VERSIONS)))
ARCHIVE_TARGETS := $(patsubst %, archive-%, $(DISTRIBUTIONS))
DRIVER_ARCHIVE_TARGETS := $(foreach archive_target, $(ARCHIVE_TARGETS), $(addprefix $(archive_target)-, $(DRIVER_VERSIONS)))
BASE_BUILD := $(patsubst %, build-base-%, $(BASE_FROM))
BASE_PUSH := $(patsubst %, push-base-%, $(BASE_FROM))
BASE_BUILD_TARGETS := $(foreach target,$(BASE_BUILD),$(target))
BASE_PUSH_TARGETS := $(foreach target,$(BASE_PUSH),$(target))
PHONY: $(BASE_BUILD_TARGETS) $(BASE_PUSH_TARGETS) $(DISTRIBUTIONS) $(PUSH_TARGETS) $(BUILD_TARGETS) $(TEST_TARGETS) $(PULL_TARGETS) $(ARCHIVE_TARGETS) $(DRIVER_PUSH_TARGETS) $(DRIVER_BUILD_TARGETS) $(DRIVER_PULL_TARGETS) $(DRIVER_ARCHIVE_TARGETS) $(VGPU_GUEST_DRIVER_BUILD_TARGETS) $(VGPU_GUEST_DRIVER_PUSH_TARGETS) $(VGPU_HOST_DRIVER_BUILD_TARGETS) $(VGPU_HOST_DRIVER_PUSH_TARGETS)
ifeq ($(BUILD_MULTI_ARCH_IMAGES),true)
include $(CURDIR)/multi-arch.mk
else
include $(CURDIR)/native-only.mk
endif
pull-%: DIST = $(word 2,$(subst -, ,$@))
pull-%: DRIVER_VERSION = $(word 3,$(subst -, ,$@))
pull-%: DRIVER_BRANCH = $(word 1,$(subst ., ,${DRIVER_VERSION}))
$(PULL_TARGETS): %: $(foreach driver_version, $(DRIVER_VERSIONS), $(addprefix %-, $(driver_version)))
pull-signed_ubuntu22.04%: DIST = ubuntu22.04
pull-signed_ubuntu22.04%: DRIVER_TAG = $(DRIVER_BRANCH)
pull-signed_ubuntu22.04%: IMAGE_TAG = $(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
pull-signed_ubuntu24.04%: DIST = ubuntu24.04
pull-signed_ubuntu24.04%: DRIVER_TAG = $(DRIVER_BRANCH)
pull-signed_ubuntu24.04%: IMAGE_TAG = $(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
pull-signed_ubuntu26.04%: DIST = ubuntu26.04
pull-signed_ubuntu26.04%: DRIVER_TAG = $(DRIVER_BRANCH)
pull-signed_ubuntu26.04%: IMAGE_TAG = $(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
PLATFORM ?= linux/amd64
$(DRIVER_PULL_TARGETS): pull-%:
$(DOCKER) pull "--platform=$(PLATFORM)" "$(IMAGE)"
archive-%: DIST = $(word 2,$(subst -, ,$@))
archive-%: DRIVER_VERSION = $(word 3,$(subst -, ,$@))
archive-%: DRIVER_BRANCH = $(word 1,$(subst ., ,${DRIVER_VERSION}))
$(ARCHIVE_TARGETS): %: $(foreach driver_version, $(DRIVER_VERSIONS), $(addprefix %-, $(driver_version)))
archive-signed_ubuntu22.04%: DIST = ubuntu22.04
archive-signed_ubuntu22.04%: DRIVER_TAG = $(DRIVER_BRANCH)
archive-signed_ubuntu22.04%: IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
archive-signed_ubuntu24.04%: DIST = ubuntu24.04
archive-signed_ubuntu24.04%: DRIVER_TAG = $(DRIVER_BRANCH)
archive-signed_ubuntu24.04%: IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
archive-signed_ubuntu26.04%: DIST = ubuntu26.04
archive-signed_ubuntu26.04%: DRIVER_TAG = $(DRIVER_BRANCH)
archive-signed_ubuntu26.04%: IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
$(DRIVER_ARCHIVE_TARGETS): archive-%:
$(DOCKER) save "$(IMAGE)" -o "archive.tar"
# $(DRIVER_PUSH_TARGETS) is in the form of push-$(DIST)-$(DRIVER_VERSION)
# Parse the target to set the required variables.
push-%: DIST = $(word 2,$(subst -, ,$@))
push-%: DRIVER_VERSION = $(word 3,$(subst -, ,$@))
push-%: DRIVER_BRANCH = $(word 1,$(subst ., ,${DRIVER_VERSION}))
# push-ubuntu22.04 pushes all driver images for ubuntu22.04
# push-ubuntu22.04-$(DRIVER_VERSION) pushes an image for the specific $(DRIVER_VERSION)
$(PUSH_TARGETS): %: $(foreach driver_version, $(DRIVER_VERSIONS), $(addprefix %-, $(driver_version)))
push-signed_ubuntu22.04%: DIST = ubuntu22.04
push-signed_ubuntu22.04%: DRIVER_TAG = $(DRIVER_BRANCH)
push-signed_ubuntu22.04%: IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
push-signed_ubuntu22.04%: OUT_IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
push-signed_ubuntu24.04%: DIST = ubuntu24.04
push-signed_ubuntu24.04%: DRIVER_TAG = $(DRIVER_BRANCH)
push-signed_ubuntu24.04%: IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
push-signed_ubuntu24.04%: OUT_IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
push-signed_ubuntu26.04%: DIST = ubuntu26.04
push-signed_ubuntu26.04%: DRIVER_TAG = $(DRIVER_BRANCH)
push-signed_ubuntu26.04%: IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
push-signed_ubuntu26.04%: OUT_IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
# $(DRIVER_BUILD_TARGETS) is in the form of build-$(DIST)-$(DRIVER_VERSION)
# Parse the target to set the required variables.
build-%: DIST = $(word 2,$(subst -, ,$@))
build-%: DRIVER_VERSION = $(word 3,$(subst -, ,$@))
build-%: DRIVER_BRANCH = $(word 1,$(subst ., ,${DRIVER_VERSION}))
build-%: SUBDIR = $(word 2,$(subst -, ,$@))
build-%: DOCKERFILE = $(CURDIR)/$(SUBDIR)/Dockerfile
# Both ubuntu22.04 and build-ubuntu22.04 trigger a build of all driver images for ubuntu22.04
# build-ubuntu22.04-$(DRIVER_VERSION) triggers a build for a specific $(DRIVER_VERSION)
$(DISTRIBUTIONS): %: build-%
$(BUILD_TARGETS): %: $(foreach driver_version, $(DRIVER_VERSIONS), $(addprefix %-, $(driver_version)))
DOCKER_BUILD_TAG_OPTION = $(if $(findstring type=oci,$(DOCKER_BUILD_OPTIONS)),,--tag $(IMAGE))
$(DRIVER_BUILD_TARGETS):
DOCKER_BUILDKIT=1 \
$(DOCKER) $(BUILDX) build --pull \
$(DOCKER_BUILD_OPTIONS) \
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
$(DOCKER_BUILD_TAG_OPTION) \
--build-arg DRIVER_VERSION="$(DRIVER_VERSION)" \
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
--build-arg DRIVER_BRANCH="$(DRIVER_BRANCH)" \
--build-arg CUDA_VERSION="$(CUDA_VERSION)" \
--build-arg CVE_UPDATES="$(CVE_UPDATES)" \
--build-arg GIT_COMMIT="$(GIT_COMMIT)" \
--build-arg DIST="$(DIST)" \
--build-arg BUILD_TIMESTAMP="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")" \
$(DOCKER_BUILD_ARGS) \
--file $(DOCKERFILE) \
$(CURDIR)/$(SUBDIR)
build-rhcos%: SUBDIR = rhel9
# The rocky targets reuse the rhel Dockerfiles with a Rocky Linux base image.
# We use the -ubi image flavor published by the Rocky Enterprise Software
# Foundation: its package set mirrors the Red Hat UBI images that the rhel
# Dockerfiles are written against, so the same Dockerfile works unmodified.
build-rocky8%: SUBDIR = rhel8
build-rocky8%: DOCKER_BUILD_ARGS = --build-arg BASE_IMAGE=rockylinux/rockylinux:8.10-ubi
build-rocky9%: SUBDIR = rhel9
build-rocky9%: DOCKER_BUILD_ARGS = --build-arg BASE_IMAGE=rockylinux/rockylinux:9.8-ubi
build-rocky10%: SUBDIR = rhel10
build-rocky10%: DOCKER_BUILD_ARGS = --build-arg BASE_IMAGE=rockylinux/rockylinux:10.2-ubi
# ubuntu22.04 Precompiled Driver
build-signed_ubuntu22.04%: DIST = ubuntu22.04
build-signed_ubuntu22.04%: SUBDIR = ubuntu22.04/precompiled
build-signed_ubuntu22.04%: DRIVER_TAG = $(DRIVER_BRANCH)
build-signed_ubuntu22.04%: IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
build-signed_ubuntu22.04%: DOCKER_BUILD_ARGS = --build-arg KERNEL_VERSION="$(KERNEL_VERSION)"
# ubuntu24.04 Precompiled Driver
build-signed_ubuntu24.04%: DIST = ubuntu24.04
build-signed_ubuntu24.04%: SUBDIR = ubuntu24.04/precompiled
build-signed_ubuntu24.04%: DRIVER_TAG = $(DRIVER_BRANCH)
build-signed_ubuntu24.04%: IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
build-signed_ubuntu24.04%: DOCKER_BUILD_ARGS = --build-arg KERNEL_VERSION="$(KERNEL_VERSION)"
# ubuntu26.04 Precompiled Driver
build-signed_ubuntu26.04%: DIST = ubuntu26.04
build-signed_ubuntu26.04%: SUBDIR = ubuntu26.04/precompiled
build-signed_ubuntu26.04%: DRIVER_TAG = $(DRIVER_BRANCH)
build-signed_ubuntu26.04%: IMAGE_TAG = $(if $(VERSION),$(VERSION)-)$(DRIVER_BRANCH)-$(KERNEL_VERSION)-$(DIST)
build-signed_ubuntu26.04%: DOCKER_BUILD_ARGS = --build-arg KERNEL_VERSION="$(KERNEL_VERSION)"
# base is an image used to poll Canonical for the latest kernel version
# LTS_KERNEL must be defined in the environment when invoking this target.
LTS_KERNEL ?= ""
build-base-%: $(if $(LTS_KERNEL),,$(error "LTS_KERNEL is not set"))
build-base-%: DOCKERFILE = $(CURDIR)/base/Dockerfile
build-base-%: TARGET = $(word 3,$(subst -, ,$@))
build-base-%: IMAGE_TAG = base-$(word 3,$(subst -, ,$@))-$(LTS_KERNEL)-$(KERNEL_FLAVOR)-$(DRIVER_BRANCH)
$(BASE_BUILD_TARGETS):
DOCKER_BUILDKIT=1 \
$(DOCKER) $(BUILDX) build --pull --no-cache \
$(DOCKER_BUILD_OPTIONS) \
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
--tag $(IMAGE) \
--target $(TARGET) \
--build-arg CUDA_VERSION="$(CUDA_VERSION)" \
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
--build-arg DRIVER_BRANCH="$(DRIVER_BRANCH)" \
--build-arg KERNEL_FLAVOR="$(KERNEL_FLAVOR)" \
--build-arg LTS_KERNEL="$(LTS_KERNEL)" \
--file $(DOCKERFILE) \
$(CURDIR)/base
push-base-%: TARGET = $(word 3,$(subst -, ,$@))
push-base-%: IMAGE_TAG = base-$(word 3,$(subst -, ,$@))-$(LTS_KERNEL)-$(KERNEL_FLAVOR)-$(DRIVER_BRANCH)
push-base-%: OUT_IMAGE_TAG = ${IMAGE_TAG}
$(BASE_PUSH_TARGETS):
regctl \
image copy \
$(IMAGE) $(OUT_IMAGE)
# $(VGPU_GUEST_DRIVER_BUILD_TARGETS) is in the form of build-vgpuguest-$(DIST)
# The vGPU guest driver .run file is assumed to be present in the $SUBDIR/drivers/ directory.
# VGPU_GUEST_DRIVER_VERSION must be defined in the environment when invoking this target.
VGPU_GUEST_DRIVER_VERSION ?= ""
build-vgpuguest-%: $(if $(VGPU_GUEST_DRIVER_VERSION),,$(error "VGPU_GUEST_DRIVER_VERSION is not set"))
# Ensure DRIVER_VERSION has the -grid suffix
build-vgpuguest-%: DRIVER_VERSION := $(addsuffix -grid,$(VGPU_GUEST_DRIVER_VERSION:-grid=))
build-vgpuguest-%: DRIVER_BRANCH = $(word 1,$(subst ., ,${DRIVER_VERSION}))
build-vgpuguest-%: DIST = $(word 3,$(subst -, ,$@))
build-vgpuguest-%: SUBDIR = $(word 3,$(subst -, ,$@))
build-vgpuguest-%: DOCKERFILE = $(CURDIR)/$(SUBDIR)/Dockerfile
# Remove '-grid' substring in the image tag
build-vgpuguest-%: DRIVER_TAG = $(DRIVER_VERSION:-grid=)
# Source of truth for RHEL and CoreOS compatibility https://access.redhat.com/articles/6907891
build-vgpuguest-rhcos%: SUBDIR = rhel9
build-vgpuguest-rhel9%: SUBDIR = rhel9
$(VGPU_GUEST_DRIVER_BUILD_TARGETS):
DOCKER_BUILDKIT=1 \
$(DOCKER) $(BUILDX) build --pull \
$(DOCKER_BUILD_OPTIONS) \
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
--tag $(IMAGE) \
--build-arg DRIVER_TYPE=vgpu \
--build-arg VGPU_LICENSE_SERVER_TYPE=NLS \
--build-arg DRIVER_VERSION="$(DRIVER_VERSION)" \
--build-arg DRIVER_BRANCH="$(DRIVER_BRANCH)" \
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
--build-arg CVE_UPDATES="$(CVE_UPDATES)" \
--build-arg GIT_COMMIT="$(GIT_COMMIT)" \
--build-arg DIST="$(DIST)" \
--build-arg BUILD_TIMESTAMP="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")" \
$(DOCKER_BUILD_ARGS) \
--file $(DOCKERFILE) \
$(CURDIR)/$(SUBDIR)
# $(VGPU_GUEST_DRIVER_PUSH_TARGETS) is in the form of push-vgpuguest-$(DIST)
# VGPU_GUEST_DRIVER_VERSION must be defined in the environment when invoking this target.
push-vgpuguest-%: $(if $(VGPU_GUEST_DRIVER_VERSION),,$(error "VGPU_GUEST_DRIVER_VERSION is not set"))
# Remove '-grid' substring in the image tag
push-vgpuguest-%: DRIVER_TAG = $(VGPU_GUEST_DRIVER_VERSION:-grid=)
push-vgpuguest-%: DIST = $(word 3,$(subst -, ,$@))
# $(VGPU_HOST_DRIVER_BUILD_TARGETS) is in the form of build-vgpuhost-$(DIST)
# The vGPU host driver .run file is assumed to be present in the $SUBDIR/drivers/ directory.
# VGPU_HOST_DRIVER_VERSION must be defined in the environment when invoking this target.
VGPU_HOST_DRIVER_VERSION ?= ""
# CUSTOM_CA_CERTS_DIR is the path (relative to the build context
# vgpu-manager/$(SUBDIR)) of a directory containing custom CA certificates to
# trust at build time. Default is "certs", an empty directory shipped in the
# repo so the COPY in the Dockerfile is a no-op out of the box.
CUSTOM_CA_CERTS_DIR ?= certs
build-vgpuhost-%: $(if $(VGPU_HOST_DRIVER_VERSION),,$(error "VGPU_HOST_DRIVER_VERSION is not set"))
build-vgpuhost-%: DRIVER_VERSION := $(VGPU_HOST_DRIVER_VERSION)
build-vgpuhost-%: DRIVER_BRANCH = $(word 1,$(subst ., ,${DRIVER_VERSION}))
build-vgpuhost-%: DIST = $(word 3,$(subst -, ,$@))
build-vgpuhost-%: SUBDIR = $(word 3,$(subst -, ,$@))
build-vgpuhost-%: DOCKERFILE = $(CURDIR)/vgpu-manager/$(SUBDIR)/Dockerfile
# Source of truth for RHEL and CoreOS compatibility https://access.redhat.com/articles/6907891
build-vgpuhost-rhcos%: SUBDIR = rhel9
build-vgpuhost-rhel9%: SUBDIR = rhel9
$(VGPU_HOST_DRIVER_BUILD_TARGETS):
DOCKER_BUILDKIT=1 \
$(DOCKER) $(BUILDX) build --pull \
$(DOCKER_BUILD_OPTIONS) \
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
--tag $(IMAGE) \
--build-arg DRIVER_BRANCH="$(DRIVER_BRANCH)" \
--build-arg DRIVER_VERSION="$(DRIVER_VERSION)" \
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
--build-arg CVE_UPDATES="$(CVE_UPDATES)" \
--build-arg CUDA_VERSION="$(CUDA_VERSION)" \
--build-arg CUSTOM_CA_CERTS_DIR="$(CUSTOM_CA_CERTS_DIR)" \
--build-arg GIT_COMMIT="$(GIT_COMMIT)" \
--build-arg DIST="$(DIST)" \
--build-arg BUILD_TIMESTAMP="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")" \
$(DOCKER_BUILD_ARGS) \
--file $(DOCKERFILE) \
$(CURDIR)/vgpu-manager/$(SUBDIR)
# $(VGPU_HOST_DRIVER_PUSH_TARGETS) is in the form of push-vgpuhost-$(DIST)
# VGPU_HOST_DRIVER_VERSION must be defined in the environment when invoking this target.
push-vgpuhost-%: $(if $(VGPU_HOST_DRIVER_VERSION),,$(error "VGPU_HOST_DRIVER_VERSION is not set"))
push-vgpuhost-%: DRIVER_TAG = $(VGPU_HOST_DRIVER_VERSION)
push-vgpuhost-%: DIST = $(word 3,$(subst -, ,$@))