Skip to content

Commit

Permalink
Fix Makefiles to allow alternative container engines
Browse files Browse the repository at this point in the history
Some users want to use buildah instead of podman to build
their container engines.

Buildah does not support --squash-all but after examining the podman
code --squash-all ends up just being the equivalent of "--squash --layers=false"

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Jun 9, 2024
1 parent 62abb17 commit 3b18983
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions model_servers/common/Makefile.common
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONTAINER_TOOL ?= podman
REGISTRY ?= quay.io
REGISTRY_ORG ?= ai-lab
COMPONENT ?= model_servers
Expand Down
4 changes: 2 additions & 2 deletions model_servers/llamacpp_python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ all: build download-model-granite run

.PHONY: build-cuda
build-cuda:
podman build --squash-all -t $(CUDA_IMAGE) . -f cuda/Containerfile
"${CONTAINER_TOOL}" build --squash --layers=false -t $(CUDA_IMAGE) . -f cuda/Containerfile

.PHONY: build-vulkan
build-vulkan:
podman build --squash-all -t $(VULKAN_IMAGE) . -f vulkan/Containerfile
"${CONTAINER_TOOL}" build --squash --layers=false -t $(VULKAN_IMAGE) . -f vulkan/Containerfile

.PHONY: download-model-granite # default model
download-model-granite:
Expand Down
3 changes: 2 additions & 1 deletion models/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONTAINER_TOOL ?= podman
MODEL_URL ?= https://huggingface.co/instructlab/granite-7b-lab-GGUF/resolve/main/granite-7b-lab-Q4_K_M.gguf
MODEL_NAME ?= granite-7b-lab-Q4_K_M.gguf

Expand All @@ -9,7 +10,7 @@ IMAGE ?= $(REGISTRY)/$(REGISTRY_ORG)/$(MODEL_NAME):latest

.PHONY: build
build:
podman build $(MODEL_URL:%=--build-arg MODEL_URL=%) -f Containerfile -t ${IMAGE} .
"${CONTAINER_TOOL}" build $(MODEL_URL:%=--build-arg MODEL_URL=%) -f Containerfile -t ${IMAGE} .

.PHONY: download-model
download-model:
Expand Down
2 changes: 1 addition & 1 deletion recipes/natural_language_processing/rag/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ run:
# rag requires custom bootc because it uses an extra build-arg for CHROMADB_IMAGE (other apps use ../../common/Makefile.common target)
.PHONY: bootc
bootc: quadlet
podman build \
"${CONTAINER_TOOL}" build \
$(ARCH:%=--arch %) \
$(FROM:%=--from %) \
$(AUTH_JSON:%=-v %:/run/containers/0/auth.json) \
Expand Down
2 changes: 1 addition & 1 deletion training/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ cloud: cloud-amd cloud-intel cloud

#
# We often see users running out of space. These commands are useful for freeing wasted space.
# Note becarful to not run this target if a podman build is in progress.
# Note be careful to not run this target if a podman build is in progress.
#
.PHONY: prune
prune:
Expand Down
2 changes: 1 addition & 1 deletion training/deepspeed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ image:
$(ARCH:%=--platform linux/%) \
--file Containerfile \
--layers=false \
--squash-all \
--squash \
--tag oci:../build/deepspeed-trainer .
8 changes: 5 additions & 3 deletions training/instructlab/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CONTAINER_TOOL ?= podman

default: instructlab

INSTRUCTLAB_GIT_REPO ?= https://github.com/instructlab/instructlab.git
Expand All @@ -12,14 +14,14 @@ instructlab:
.PHONY: nvidia
nvidia: instructlab
rm -rf ../build/instructlab-$@
podman build --layers=false --squash-all -t oci:../build/instructlab-$@ instructlab/containers/cuda
"${CONTAINER_TOOL}" build --layers=false --squash -t oci:../build/instructlab-$@ instructlab/containers/cuda

.PHONY: amd
amd: instructlab
rm -rf ../build/instructlab-$@
podman build --layers=false --squash-all -t oci:../build/instructlab-$@ -f instructlab/containers/rocm/Containerfile instructlab
"${CONTAINER_TOOL}" build --layers=false --squash -t oci:../build/instructlab-$@ -f instructlab/containers/rocm/Containerfile instructlab

.PHONY: intel
intel: instructlab
rm -rf ../build/instructlab-$@
podman build --layers=false --squash-all -t oci:../build/instructlab-$@ -f instructlab/containers/hpu/Containerfile instructlab
"${CONTAINER_TOOL}" build --layers=false --squash -t oci:../build/instructlab-$@ -f instructlab/containers/hpu/Containerfile instructlab
2 changes: 1 addition & 1 deletion training/vllm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ image:
$(ARCH:%=--platform linux/%) \
--file Containerfile \
--layers=false \
--squash-all \
--squash \
--tag oci:../build/vllm .
3 changes: 2 additions & 1 deletion vector_dbs/chromadb/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CONTAINER_TOOL ?= podman
APP ?= chromadb
APPIMAGE ?= quay.io/ai-lab/${APP}:latest

.PHONY: build
build:
podman build -f Containerfile -t ${APPIMAGE} .
"${CONTAINER_TOOL}" build -f Containerfile -t ${APPIMAGE} .
3 changes: 2 additions & 1 deletion vector_dbs/milvus/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONTAINER_TOOL ?= podman
REGISTRY ?= quay.io
REGISTRY_ORG ?= ai-lab
COMPONENT = vector_dbs
Expand All @@ -15,7 +16,7 @@ LIB_MILVUS_DIR_MOUNTPATH := $(shell pwd)/volumes/milvus

.PHONY: build
build:
podman build --platform $(PLATFORM) -f Containerfile -t ${IMAGE} .
"${CONTAINER_TOOL}" build --platform $(PLATFORM) -f Containerfile -t ${IMAGE} .

.PHONY: run
run:
Expand Down

0 comments on commit 3b18983

Please sign in to comment.