Skip to content

Commit

Permalink
Address PR feedback. Remove sentinel file
Browse files Browse the repository at this point in the history
  • Loading branch information
ncapps committed Jan 26, 2024
1 parent 24511e6 commit 171deb3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
9 changes: 4 additions & 5 deletions site/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Credit to Julien Guyomard (https://github.com/jguyomard). This Dockerfile
# is essentially based on his Dockerfile at
# https://github.com/jguyomard/docker-hugo/blob/master/Dockerfile. The only significant
# change is that the Hugo version is now an overridable argument rather than a fixed
# environment variable.
# Credit to Julien Guyomard (https://github.com/jguyomard)
# Credit to the Kubernetes Website team.
# This Dockerfile is based on:
# (https://github.com/kubernetes/website/blob/main/Dockerfile)

FROM docker.io/library/golang:1.20-alpine

Expand Down
16 changes: 4 additions & 12 deletions site/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Credit to the Kubernetes Website team. (https://github.com/kubernetes/website/blob/main/Makefile)
HUGO_VERSION = $(shell grep ^HUGO_VERSION netlify.toml | tail -n 1 | cut -d '=' -f 2 | tr -d " \"\n")
NODE_BIN = node_modules/.bin
NETLIFY_FUNC = $(NODE_BIN)/netlify-lambda

# The CONTAINER_ENGINE variable is used for specifying the container engine. By default 'docker' is used
# but this can be overridden when calling make, e.g.
Expand All @@ -17,9 +15,6 @@ CONTAINER_RUN = "$(CONTAINER_ENGINE)" run --rm --interactive --tty --volume
CCRED=\033[0;31m
CCEND=\033[0m

# Docker buildx related settings for multi-arch images
DOCKER_BUILDX ?= docker buildx

.PHONY: help
help: ## Show this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
Expand Down Expand Up @@ -48,21 +43,18 @@ build-preview: module-check ## Build site with drafts and future posts enabled
serve: module-check ## Boot the development server.
hugo server --buildFuture --environment development

container-image.sentinel: netlify.toml Dockerfile hugo.toml Makefile
## Build a container image for the preview of the website
.PHONY: container-image
container-image: netlify.toml Dockerfile hugo.toml
$(CONTAINER_ENGINE) build . \
--network=host \
--tag $(CONTAINER_IMAGE) \
--build-arg HUGO_VERSION=$(HUGO_VERSION)
@touch $@

## Build a container image for the preview of the website
.PHONY: container-image
container-image: container-image.sentinel

# no build lock to allow for read-only mounts
## Boot the development server using container.
.PHONY: container-serve
container-serve: module-check container-image.sentinel
container-serve: module-check
$(CONTAINER_RUN) \
--cap-drop=ALL \
--cap-add=AUDIT_WRITE \
Expand Down
4 changes: 4 additions & 0 deletions site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ To build the site in a container, run the following:

```bash
# You can set $CONTAINER_ENGINE to the name of any Docker-like container tool
# Build the image
make container-image

# Run the container
make container-serve
```

Expand Down

0 comments on commit 171deb3

Please sign in to comment.