-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (50 loc) · 2.12 KB
/
Makefile
File metadata and controls
60 lines (50 loc) · 2.12 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
# Copyright (C) 2025 Intel 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 Lic
# 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.
# Example usage:
# make build ARTIFACTORY_URL=http://your.artifactory.url HABANALABS_INSTALL_SCRIPT=install_script.sh
# make push IMAGE_NAME=your_image_name TAG=your_tag
# Default values for arguments
ARTIFACTORY_URL ?= artifactory-kfs.habana-labs.com
RELEASE_VERSION ?= master
RELEASE_BUILD_ID ?= no_release_build_id
BUILD_OS ?= generic
DOCKER_REPO ?= docker-local
# Add _ after the OS name to match the Docker image name.
# Needed for the driver daemonset.
# DriverBuildOs = $(shell echo $(BUILD_OS) | sed -E 's/([a-zA-Z]+)([0-9]+)/\1_\2/')
IMAGE_NAME ?= $(ARTIFACTORY_URL)/$(DOCKER_REPO)/$(RELEASE_VERSION)/$(BUILD_OS)/habanalabs/driver-installer
TAG ?= $(RELEASE_VERSION)-$(RELEASE_BUILD_ID)
HABANALABS_INSTALL_SCRIPT = hl-generic-prod-local/$(RELEASE_VERSION)/$(RELEASE_BUILD_ID)/installer/habanalabs-installer.sh
# Makefile targets
.PHONY: build push test
build:
ifneq ($(BUILD_OS),generic)
echo $(ARTIFACTORY_URL)
echo $(HABANALABS_INSTALL_SCRIPT)
docker build \
--build-arg ARTIFACTORY_URL=$(ARTIFACTORY_URL) \
--build-arg HABANALABS_INSTALL_SCRIPT=$(HABANALABS_INSTALL_SCRIPT) \
-t $(IMAGE_NAME):$(TAG) \
-f $(BUILD_OS)/Dockerfile \
.
else
docker build \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VERSION="$(RELEASE_VERSION)-${RELEASE_BUILD_ID}" \
--build-arg SCRIPT_URL="https://${ARTIFACTORY_URL}/artifactory/${HABANALABS_INSTALL_SCRIPT}" \
--tag $(IMAGE_NAME):$(TAG) \
--file $(BUILD_OS)/Dockerfile \
.
endif
push:
docker push $(IMAGE_NAME):$(TAG)
test:
IMAGE=$(IMAGE_NAME):$(TAG) ./scripts/tests.sh