-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #415 from rhatdan/instructlab
Add cloud-init build feature
- Loading branch information
Showing
6 changed files
with
171 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,71 @@ | ||
default: help | ||
|
||
help: | ||
@echo "Please choose one of the following targets:" | ||
@echo " - amd" | ||
@echo " - nvidia" | ||
@echo " - intel" | ||
@echo "To build a bootable container image you first need to create instructlab container images for a particular vendor " | ||
@echo | ||
@echo " - make instruct-amd" | ||
@echo " - make instruct-intel" | ||
@echo " - make instruct-nvidia" | ||
@echo " - make instruct-vllm" | ||
@echo | ||
@echo "Once instruct images are created, creat bootc container images" | ||
@echo | ||
@echo " - make bootc-amd" | ||
@echo " - make bootc-intel" | ||
@echo " - make bootc-nvidia" | ||
@echo " - make bootc-vllm" | ||
@echo | ||
@echo "If these images are going to be used on a cloud, you might want to add cloud-init." | ||
@echo | ||
@echo " - make cloud-amd" | ||
@echo " - make cloud-intel" | ||
@echo " - make cloud-nvidia" | ||
@echo " - make cloud-vllm" | ||
|
||
.PHONY: amd nvidia intel | ||
# | ||
# Create instructlab AI container images | ||
# | ||
.PHONY: | ||
instruct-amd: | ||
make -C instructlab amd | ||
|
||
.PHONY: | ||
instruct-nvidia: | ||
make -C instructlab nvidia | ||
|
||
.PHONY: | ||
instruct: instruct-amd instruct-nvidia | ||
|
||
# | ||
# Create bootc container images prepared for AI | ||
# | ||
.PHONY: amd nvidia intel vllm | ||
amd: | ||
make -C amd-bootc/ image | ||
nvidia: | ||
make -C nvidia-bootc/ dtk image | ||
make -C amd-bootc/ bootc | ||
intel: | ||
make -C intel-bootc/ image | ||
make -C intel-bootc/ bootc | ||
nvidia: | ||
make -C nvidia-bootc/ dtk bootc | ||
vllm: | ||
make -C vllm/ image | ||
|
||
# | ||
# Make Bootc container images preinstalled with cloud-init | ||
# | ||
.PHONY: | ||
cloud-amd: | ||
make VENDOR=amd -C cloud | ||
|
||
.PHONY: | ||
cloud-intel: | ||
make VENDOR=intel -C cloud | ||
|
||
.PHONY: | ||
cloud-nvidia: | ||
make VENDOR=nvidia -C cloud | ||
|
||
.PHONY: | ||
cloud: cloud-amd cloud-intel cloud | ||
|
||
clean: | ||
rm -rf build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM ?= | ||
VENDOR ?= | ||
|
||
REGISTRY ?= quay.io | ||
REGISTRY_ORG ?= ai-lab | ||
IMAGE_NAME ?= $(VENDOR)-bootc | ||
IMAGE_TAG ?= latest | ||
|
||
CONTAINER_TOOL ?= podman | ||
CONTAINER_TOOL_EXTRA_ARGS ?= | ||
|
||
ARCH ?= | ||
|
||
DRIVER_VERSION ?= | ||
KERNEL_VERSION ?= | ||
|
||
ARCH ?= | ||
|
||
INSTRUCTLAB_IMAGE = $(REGISTRY)/$(REGISTRY_ORG)/instructlab-$(VENDOR):$(IMAGE_TAG) | ||
INSTRUCTLAB_IMAGE_ID = $(shell $(CONTAINER_TOOL) image inspect $(INSTRUCTLAB_IMAGE) --format {{.Id}}) | ||
WRAPPER = $(CURDIR)/../ilab-wrapper/ilab | ||
OUTDIR = $(CURDIR)/../build | ||
|
||
SSH_PUBKEY ?= $(shell cat ${HOME}/.ssh/id_rsa.pub 2> /dev/null) | ||
|
||
.PHONY: prepare-files | ||
prepare-files: $(OUTDIR)/$(WRAPPER) $(OUTDIR)/$(INSTRUCTLAB_IMAGE_ID) | ||
|
||
$(OUTDIR): | ||
mkdir -p $(OUTDIR) | ||
|
||
$(OUTDIR)/$(WRAPPER): $(OUTDIR) | ||
cp -f $(WRAPPER) $(OUTDIR) | ||
|
||
$(OUTDIR)/$(INSTRUCTLAB_IMAGE_ID): | ||
@mkdir -p $(OUTDIR)/$(INSTRUCTLAB_IMAGE_ID) | ||
$(CONTAINER_TOOL) push --compress=false $(INSTRUCTLAB_IMAGE) oci:$(OUTDIR)/$(INSTRUCTLAB_IMAGE_ID)/ | ||
|
||
.PHONY: check-sshkey | ||
check-sshkey: | ||
@test -n "$(SSH_PUBKEY)" || \ | ||
(echo -n "Error: no ssh key defined! "; \ | ||
echo "Create ~/.ssh/id_rsa.pub or set SSH_PUBKEY"; exit 1) | ||
|
||
.PHONY: push | ||
push: | ||
podman push "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
default: cloud | ||
|
||
include ../Makefile.common | ||
|
||
REGISTRY ?= quay.io | ||
REGISTRY_ORG ?= ai-lab | ||
IMAGE_TAG ?= latest | ||
|
||
.PHONY: init | ||
init: | ||
git clone https://gitlab.com/bootc-org/examples.git 2> /dev/null || true | ||
(cd examples; git pull origin main) | ||
|
||
.PHONY: cloud | ||
cloud: init | ||
"${CONTAINER_TOOL}" build \ | ||
$(ARCH:%=--platform linux/%) \ | ||
--tag "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}-cloud:${IMAGE_TAG}" \ | ||
--from="${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" \ | ||
examples/cloud-init | ||
|
||
.PHONY: push | ||
push: push-amd push-nvidia |