Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfile and .dockerignore with targets in Makefile #1644

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)