File size: 2,676 Bytes
c33a7ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
CONTAINER_TOOL ?= podman

MAKEFLAGS += -j2

help:
	@echo "Build a instructlab container image for specified vendor "
	@echo
	@echo "  - make amd"
	@echo "  - make intel"
	@echo "  - make nvidia"
	@echo "  - make nvidia-quay"
	@echo "  - make amd-quay"
	@echo "  - make intel-quay"

default: help

.PHONY: all
all: nvidia intel amd

INSTRUCTLAB_GIT_REPO ?= https://github.com/instructlab/instructlab.git
INSTRUCTLAB_GIT_BRANCH ?= main

REGISTRY ?= quay.io
REGISTRY_ORG ?= ai-lab
IMAGE_TAG ?= latest
INSTRUCTLAB_IMAGE_AMD ?= ${REGISTRY}/${REGISTRY_ORG}/instructlab-amd:${IMAGE_TAG}
INSTRUCTLAB_IMAGE_INTEL ?= ${REGISTRY}/${REGISTRY_ORG}/instructlab-intel:${IMAGE_TAG}
INSTRUCTLAB_IMAGE_NVIDIA ?= ${REGISTRY}/${REGISTRY_ORG}/instructlab-nvidia:${IMAGE_TAG}


./instructlab:
	@mkdir -p ../build
	git clone $(INSTRUCTLAB_GIT_REPO) instructlab 2> /dev/null || true
	(cd instructlab; git pull origin $(INSTRUCTLAB_GIT_BRANCH))


../build/instructlab-nvidia/oci-layout: ./instructlab
	rm -rf ../build/instructlab-nvidia/
	"${CONTAINER_TOOL}" build \
		--squash-all \
		-t oci:../build/instructlab-nvidia \
		$(VENDOR:%=--build-arg VENDOR=%) \
		instructlab/containers/cuda

.PHONY: nvidia
nvidia: ../build/instructlab-nvidia/oci-layout

../build/instructlab-amd/oci-layout: ./instructlab
	rm -rf ../build/instructlab-amd/
	"${CONTAINER_TOOL}" build \
		--squash-all \
		-t oci:../build/instructlab-amd \
		-f instructlab/containers/rocm/Containerfile \
		$(VENDOR:%=--build-arg VENDOR=%) \
		instructlab

.PHONY: amd
amd: ../build/instructlab-amd/oci-layout

../build/instructlab-intel/oci-layout: ./instructlab
	rm -rf ../build/instructlab-intel/
	"${CONTAINER_TOOL}" build \
		--squash-all \
		-t oci:../build/instructlab-intel \
		-f instructlab/containers/hpu/Containerfile \
		$(VENDOR:%=--build-arg VENDOR=%) \
		instructlab

.PHONY: intel
intel: ../build/instructlab-intel/oci-layout

.PHONY: nvidia-quay
nvidia-quay: instructlab
	"${CONTAINER_TOOL}" build \
		--squash-all \
		-t ${INSTRUCTLAB_IMAGE_NVIDIA} \
		$(VENDOR:%=--build-arg VENDOR=%) \
		instructlab/containers/cuda
	"${CONTAINER_TOOL}" push ${INSTRUCTLAB_IMAGE_NVIDIA}

.PHONY: amd-quay
amd-quay: instructlab
	"${CONTAINER_TOOL}" build \
		--squash-all \
		-t ${INSTRUCTLAB_IMAGE_AMD} \
		-f instructlab/containers/rocm/Containerfile \
		$(VENDOR:%=--build-arg VENDOR=%) \
		instructlab
	"${CONTAINER_TOOL}" push ${INSTRUCTLAB_IMAGE_AMD}

.PHONY: intel-quay
intel-quay: instructlab
	"${CONTAINER_TOOL}" build \
		--squash-all \
		-t ${INSTRUCTLAB_IMAGE_INTEL} \
		-f instructlab/containers/hpu/Containerfile \
		$(VENDOR:%=--build-arg VENDOR=%) \
		instructlab
	"${CONTAINER_TOOL}" push ${INSTRUCTLAB_IMAGE_INTEL}