diff options
author | Ian Lewis <ianlewis@google.com> | 2019-12-06 08:37:19 -0500 |
---|---|---|
committer | Ian Lewis <ianlewis@google.com> | 2020-01-14 17:00:07 +0900 |
commit | 6e5080f5dc3527b2382bd2a91f7d5eace4793b17 (patch) | |
tree | ec32b2e7693aae2440fb982bdb1a2bb220d613d7 /Makefile | |
parent | 89ac3bdc31d85412a9ce2073e96313588f6fb636 (diff) |
Use hugo Docker image in Makefile
Removes the local dependency on hugo for building.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 51 |
1 files changed, 38 insertions, 13 deletions
@@ -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: |