Skip to content

Commit

Permalink
Update Dockerfile and Makefile to support dynamic Hugo version
Browse files Browse the repository at this point in the history
  • Loading branch information
Andygol committed Nov 13, 2024
1 parent 18d293f commit dd93d88
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM hugomods/hugo:node
ARG HUGO_VERSION=
FROM hugomods/hugo:node-${HUGO_VERSION}

WORKDIR /src

Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit dd93d88

Please sign in to comment.