diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..d639ebad1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,23 @@ +# Ignore node_modules directory +node_modules + +# Ignore any log files +*.log + +# Ignore Dockerfile and .dockerignore itself +Dockerfile +.dockerignore + +# Ignore git repository files +.git +.gitignore + +# Ignore temporary files +tmp +*.tmp + +# Ignore build output +dist +build +resources +app diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..7b0ec108a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +ARG HUGO_VERSION= +FROM hugomods/hugo:node-${HUGO_VERSION} + +WORKDIR /src + +RUN apk update && apk add --no-cache make curl bash + +RUN npm install yarn + +COPY . . + +RUN npx yarn install + +EXPOSE 1313 + +ENTRYPOINT ["make"] diff --git a/Makefile b/Makefile index 73f9e16ad..3a48d4628 100644 --- a/Makefile +++ b/Makefile @@ -22,3 +22,19 @@ run-link-checker: bin/htmltest 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 --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 $(IMAGE_NAME) $(DOCKER_TARGET)