Skip to content

Commit 6219f38

Browse files
committed
Add logic on the build_image function to filter out the comments
1 parent 88bd194 commit 6219f38

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,10 @@ define build_image
7474
$(eval CONF_FILE := $(BUILD_DIR)build-args/$(shell echo $(DOCKERFILE_NAME) | cut -d. -f2).conf)
7575

7676
# if the conf file exists, transform it into --build-arg KEY=VALUE flags
77-
$(eval BUILD_ARGS := $(shell if [ -f $(CONF_FILE) ]; then \
78-
while IFS='=' read -r k v; do \
79-
[ -n "$$k" ] && printf -- "--build-arg %s=%s " "$$k" "$$v"; \
80-
done < $(CONF_FILE); \
81-
fi))
77+
$(eval BUILD_ARGS := $(shell \
78+
if [ -f $(CONF_FILE) ]; then \
79+
awk -F= '!/^#/ && NF {gsub(/^[ \t]+|[ \t]+$$/, "", $$1); gsub(/^[ \t]+|[ \t]+$$/, "", $$2); printf "--build-arg %s=%s ", $$1, $$2}' $(CONF_FILE); \
80+
fi))
8281

8382
$(info # Building $(IMAGE_NAME) using $(DOCKERFILE_NAME) with $(CONF_FILE) and $(BUILD_ARGS)...)
8483

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
# Base Image : UBI 9 with Python 3.12
12
BASE_IMAGE=registry.access.redhat.com/ubi9/python-312:latest

0 commit comments

Comments
 (0)