Skip to content

Commit

Permalink
Merge pull request #1644 from Andygol/docker-image
Browse files Browse the repository at this point in the history
Add Dockerfile and .dockerignore with targets in Makefile
  • Loading branch information
karenhchu authored Jan 14, 2025
2 parents ca1152e + abb751c commit 90cc2e7
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
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)

0 comments on commit 90cc2e7

Please sign in to comment.