Use hugo Docker image in Makefile

Removes the local dependency on hugo for building.
This commit is contained in:
Ian Lewis
2020-01-14 17:00:07 +09:00
parent 89ac3bdc31
commit 6e5080f5dc
2 changed files with 39 additions and 14 deletions
+38 -13
View File
@@ -1,4 +1,3 @@
HUGO := hugo
HUGO_VERSION := 0.53
HTMLPROOFER_VERSION := 3.10.2
GCLOUD := gcloud
@@ -43,12 +42,29 @@ content/docs/community/sigs: upstream/community $(wildcard upstream/community/si
$(APP_TARGET): public $(APP_SOURCE)
cp -a cmd/gvisor-website/$(patsubst public/%,%,$@) public/
static-production: compatibility-docs node_modules config.toml $(shell find archetypes assets content themes -type f | sed 's/ /\\ /g')
HUGO_ENV="production" $(HUGO)
static-production: hugo-docker-image compatibility-docs node_modules config.toml $(shell find archetypes assets content themes -type f | sed 's/ /\\ /g')
docker run \
-e HUGO_ENV="production" \
-e USER="$(shell id -u)" \
-e HOME="/tmp" \
-u="$(shell id -u):$(shell id -g)" \
-v $(PWD):/workspace \
-w /workspace \
gcr.io/gvisor-website/hugo:$(HUGO_VERSION) \
hugo
.PHONY: static-production
static-staging: compatibility-docs node_modules config.toml $(shell find archetypes assets content themes -type f | sed 's/ /\\ /g')
$(HUGO) -b "https://staging-$(shell git branch | grep \* | cut -d ' ' -f2)-dot-gvisor-website.appspot.com"
static-staging: hugo-docker-image compatibility-docs node_modules config.toml $(shell find archetypes assets content themes -type f | sed 's/ /\\ /g')
docker run \
-e HUGO_ENV="production" \
-e USER="$(shell id -u)" \
-e HOME="/tmp" \
-u="$(shell id -u):$(shell id -g)" \
-v $(PWD):/workspace \
-w /workspace \
gcr.io/gvisor-website/hugo:$(HUGO_VERSION) \
hugo \
-b "https://staging-$(shell git branch | grep \* | cut -d ' ' -f2)-dot-gvisor-website.appspot.com"
.PHONY: static-staging
node_modules: package.json package-lock.json
@@ -84,13 +100,24 @@ compatibility-docs: bin/generate-syscall-docs upstream/gvisor/bazel-bin/runsc/li
./upstream/gvisor/bazel-bin/runsc/linux_amd64_pure_stripped/runsc help syscalls -o json | ./bin/generate-syscall-docs -out ./content/docs/user_guide/compatibility/
.PHONY: compatibility-docs
check: website
docker run -v $(shell pwd)/public:/public gcr.io/gvisor-website/html-proofer:3.10.2 htmlproofer --disable-external --check-html public/static
check: htmlproofer-docker-image website
docker run -v $(shell pwd)/public:/public gcr.io/gvisor-website/html-proofer:$(HTMLPROOFER_VERSION) htmlproofer --disable-external --check-html public/static
.PHONY: check
# Run a local content development server. Redirects will not be supported.
devserver: all-upstream compatibility-docs
$(HUGO) server -FD --port 8080
devserver: hugo-docker-image all-upstream compatibility-docs
docker run \
-e USER="$(shell id -u)" \
-e HOME="/tmp" \
-u="$(shell id -u):$(shell id -g)" \
-v $(PWD):/workspace \
-w /workspace \
-p 8080:8080 \
gcr.io/gvisor-website/hugo:$(HUGO_VERSION) \
hugo server \
-FD \
--bind 0.0.0.0 \
--port 8080
.PHONY: server
server: website
@@ -116,16 +143,14 @@ stage: all-upstream app static-staging
cloud-build:
gcloud builds submit --config cloudbuild.yaml .
# Build and push the hugo Docker image used by Cloud Build.
# Build the hugo Docker image.
hugo-docker-image:
docker build --build-arg HUGO_VERSION=$(HUGO_VERSION) -t gcr.io/gvisor-website/hugo:$(HUGO_VERSION) cloudbuild/hugo/
docker push gcr.io/gvisor-website/hugo:$(HUGO_VERSION)
.PHONY: hugo-docker-image
# Build and push the html-proofer image used by Cloud Build.
# Build the html-proofer image used by Cloud Build.
htmlproofer-docker-image:
docker build --build-arg HTMLPROOFER_VERSION=$(HTMLPROOFER_VERSION) -t gcr.io/gvisor-website/html-proofer:$(HTMLPROOFER_VERSION) cloudbuild/html-proofer/
docker push gcr.io/gvisor-website/html-proofer:$(HTMLPROOFER_VERSION)
.PHONY: htmlproofer-docker-image
clean:
+1 -1
View File
@@ -13,7 +13,7 @@ RUN set -x \
libcurl \
libxml2-dev \
libxslt-dev \
openssh
openssh \
&& gem install \
html-proofer:${HTMLPROOFER_VERSION} \
nokogiri:1.10.1 \