From cb742bb0c12be193b9a1a31dc559b768f321aa19 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 10 Jun 2024 11:18:10 -0400 Subject: [PATCH] Add support for BUILD_ARG_FILE Signed-off-by: Daniel J Walsh --- recipes/common/Makefile.common | 7 ++++++- recipes/natural_language_processing/rag/Makefile | 1 + training/amd-bootc/Makefile | 1 + training/common/Makefile.common | 1 + training/deepspeed/Makefile | 2 ++ training/intel-bootc/Makefile | 1 + training/nvidia-bootc/Makefile | 2 ++ training/vllm/Makefile | 2 ++ 8 files changed, 16 insertions(+), 1 deletion(-) diff --git a/recipes/common/Makefile.common b/recipes/common/Makefile.common index 48a6f591..26ea7948 100644 --- a/recipes/common/Makefile.common +++ b/recipes/common/Makefile.common @@ -14,6 +14,7 @@ DISK_UID ?= $(shell id -u) DISK_GID ?= $(shell id -g) FROM ?= ARCH ?= +BUILD_ARG_FILE ?= CONTAINERFILE ?= Containerfile GRAPH_ROOT=$(shell podman info --format '{{ .Store.GraphRoot }}') UMASK=$(shell umask) @@ -76,12 +77,16 @@ install:: .PHONY: build build: - podman build --squash-all $(ARCH:%=--platform linux/%) $(FROM:%=--from %) -t ${APP_IMAGE} app/ + podman build --squash-all \ + $(ARCH:%=--platform linux/%) \ + $(BUILD_ARG_FILE:%=--build-arg-file=%) \ + $(FROM:%=--from %) -t ${APP_IMAGE} app/ .PHONY: bootc bootc: quadlet growfs podman build \ $(ARCH:%=--arch %) \ + $(BUILD_ARG_FILE:%=--build-arg-file=%) \ $(FROM:%=--from %) \ $(AUTH_JSON:%=-v %:/run/containers/0/auth.json) \ --security-opt label=disable \ diff --git a/recipes/natural_language_processing/rag/Makefile b/recipes/natural_language_processing/rag/Makefile index 3ac26f88..4564e247 100644 --- a/recipes/natural_language_processing/rag/Makefile +++ b/recipes/natural_language_processing/rag/Makefile @@ -18,6 +18,7 @@ run: bootc: quadlet "${CONTAINER_TOOL}" build \ $(ARCH:%=--arch %) \ + $(BUILD_ARG_FILE:%=--build-arg-file=%) \ $(FROM:%=--from %) \ $(AUTH_JSON:%=-v %:/run/containers/0/auth.json) \ --security-opt label=disable \ diff --git a/training/amd-bootc/Makefile b/training/amd-bootc/Makefile index c17bae42..5cc202fb 100644 --- a/training/amd-bootc/Makefile +++ b/training/amd-bootc/Makefile @@ -9,6 +9,7 @@ default: bootc bootc: prepare-files growfs "${CONTAINER_TOOL}" build \ $(ARCH:%=--platform linux/%) \ + $(BUILD_ARG_FILE:%=--build-arg-file=%) \ $(EXTRA_RPM_PACKAGES:%=--build-arg EXTRA_RPM_PACKAGES=%) \ $(FROM:%=--from=%) \ $(SOURCE_DATE_EPOCH:%=--timestamp=%) \ diff --git a/training/common/Makefile.common b/training/common/Makefile.common index 03d0aae9..e67b18f6 100644 --- a/training/common/Makefile.common +++ b/training/common/Makefile.common @@ -18,6 +18,7 @@ AUTH_JSON ?= SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct) BOOTC_IMAGE_BUILDER ?= quay.io/centos-bootc/bootc-image-builder +BUILD_ARG_FILE ?= IMAGE_BUILDER_CONFIG ?= IMAGE_BUILDER_EXTRA_ARGS ?= DISK_TYPE ?= qcow2 diff --git a/training/deepspeed/Makefile b/training/deepspeed/Makefile index 5e9a8913..a95e9965 100644 --- a/training/deepspeed/Makefile +++ b/training/deepspeed/Makefile @@ -1,6 +1,7 @@ IMAGE_NAME ?= deepspeed-trainer CONTAINER_TOOL ?= podman SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct) +BUILD_ARG_FILE ?= default: image @@ -10,6 +11,7 @@ image: rm -rf ../build/deepspeed-trainer "${CONTAINER_TOOL}" build \ $(ARCH:%=--platform linux/%) \ + $(BUILD_ARG_FILE:%=--build-arg-file=%) \ $(SOURCE_DATE_EPOCH:%=--timestamp=%) \ --file Containerfile \ --layers=false \ diff --git a/training/intel-bootc/Makefile b/training/intel-bootc/Makefile index 3b786f08..415af56c 100644 --- a/training/intel-bootc/Makefile +++ b/training/intel-bootc/Makefile @@ -8,6 +8,7 @@ default: bootc bootc: growfs prepare-files ${CONTAINER_TOOL} build \ $(ARCH:%=--platform linux/%) \ + $(BUILD_ARG_FILE:%=--build-arg-file=%) \ $(DRIVER_VERSION:%=--build-arg DRIVER_VERSION=%) \ $(EXTRA_RPM_PACKAGES:%=--build-arg EXTRA_RPM_PACKAGES=%) \ $(FROM:%=--build-arg BASEIMAGE=%) \ diff --git a/training/nvidia-bootc/Makefile b/training/nvidia-bootc/Makefile index 3f5c14ae..9a010750 100644 --- a/training/nvidia-bootc/Makefile +++ b/training/nvidia-bootc/Makefile @@ -16,6 +16,7 @@ default: bootc dtk: "${CONTAINER_TOOL}" build \ $(ARCH:%=--platform linux/%) \ + $(BUILD_ARG_FILE:%=--build-arg-file=%) \ $(ENABLE_RT:%=--build-arg ENABLE_RC=%) \ $(FROM:%=--from=%) \ $(KERNEL_VERSION:%=--build-arg KERNEL_VERSION=%) \ @@ -28,6 +29,7 @@ dtk: bootc: dtk check-sshkey prepare-files growfs "${CONTAINER_TOOL}" build \ $(ARCH:%=--platform linux/%) \ + $(BUILD_ARG_FILE:%=--build-arg-file=%) \ $(CUDA_VERSION:%=--build-arg CUDA_VERSION=%) \ $(DRIVER_VERSION:%=--build-arg DRIVER_VERSION=%) \ $(DRIVER_VERSION:%=--label driver-version=%) \ diff --git a/training/vllm/Makefile b/training/vllm/Makefile index 9755fc5d..c7f7af34 100644 --- a/training/vllm/Makefile +++ b/training/vllm/Makefile @@ -1,5 +1,6 @@ CONTAINER_TOOL ?= podman SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct) +BUILD_ARG_FILE ?= default: image @@ -9,6 +10,7 @@ image: rm -rf ../build/vllm "${CONTAINER_TOOL}" build \ $(ARCH:%=--platform linux/%) \ + $(BUILD_ARG_FILE:%=--build-arg-file=%) \ $(SOURCE_DATE_EPOCH:%=--timestamp=%) \ --file Containerfile \ --layers=false \