From abb751c85a5e1716bf001c7103898f8a4114184a Mon Sep 17 00:00:00 2001 From: Andrii Holovin Date: Wed, 13 Nov 2024 20:39:56 +0200 Subject: [PATCH] Update Dockerfile and Makefile to support dynamic Hugo version Signed-off-by: Andrii Holovin --- Dockerfile | 3 ++- Makefile | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2493e73aa..7b0ec108a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM hugomods/hugo:node +ARG HUGO_VERSION= +FROM hugomods/hugo:node-${HUGO_VERSION} WORKDIR /src diff --git a/Makefile b/Makefile index 6767b19f5..3a48d4628 100644 --- a/Makefile +++ b/Makefile @@ -26,11 +26,15 @@ check-links-ci: set-up-link-checker run-link-checker serve: hugo server --buildDrafts --buildFuture --bind 0.0.0.0 +HUGO_VERSION ?= $(shell grep HUGO_VERSION ./netlify.toml | head -1 | cut -d '"' -f 2) + +IMAGE_NAME ?= helm-docs + image: - docker build -t helm-docs . + docker build --build-arg HUGO_VERSION=$(HUGO_VERSION) -t $(IMAGE_NAME) . # Extract the target after 'image-run' or default to 'serve' DOCKER_TARGET = $(if $(filter-out image-run,$(MAKECMDGOALS)),$(filter-out image-run,$(MAKECMDGOALS)),serve) image-run: - docker run --rm --init -it -p 1313:1313 -v $(PWD):/src helm-docs $(DOCKER_TARGET) + docker run --rm --init -it -p 1313:1313 -v $(PWD):/src $(IMAGE_NAME) $(DOCKER_TARGET)