Skip to content
Permalink
Browse files
feat: support local preview, post split; add deploy preview (#30814)
* chore: support local preview, post split

* feat: deploy preview

* update script perms
- chmod +x ./website/scripts/website-build.sh

* npm i

* chore: website-build uses 'kevin/terraform-split'

* deploy preview test

* chore: test

* PREVIEW_DIR & CLONE_DIR = preview

* rm dupe preview path

* empty commit

* ../data & ..docs

* website-preview

* remove REPO var

* move `intro` and `guides` back to where they were

* empty commit

* chore move `intro` and `guides`

* chore: copy over images

* move images into `/website`
- content API requires this

* chore: `CURRENT_GIT_BRANCH`

* fix: `CURRENT_GIT_BRANCH`

* fix `CURRENT_GIT_BRANCH`

* debug current dir

* fix `CURRENT_GIT_BRANCH`

* chore: comment CURRENT_GIT_BRANCH

* Update Makefile

* Update website/scripts/website-build.sh

* optimize images

* chore(Makefile): move vars to top

* remove branch
  • Loading branch information
thiskevinwang committed Apr 21, 2022
1 parent 7d51ba5 commit 2563bf3f966a1d21d80209e92af8403d41c3e583
Showing 14 changed files with 690 additions and 12 deletions.
@@ -1,5 +1,20 @@
WEBSITE_REPO=github.com/hashicorp/terraform-website
VERSION?="0.3.44"
PWD=$$(pwd)
DOCKER_IMAGE="hashicorp/terraform-website:full"
DOCKER_IMAGE_LOCAL="hashicorp-terraform-website-local"
DOCKER_RUN_FLAGS=--interactive \
--rm \
--tty \
--workdir "/website" \
--volume "$(shell pwd):/website/ext/terraform" \
--volume "$(shell pwd)/website:/website/preview" \
--publish "3000:3000" \
-e "IS_CONTENT_PREVIEW=true" \
-e "PREVIEW_FROM_REPO=terraform" \
-e "NAV_DATA_DIRNAME=./preview/data" \
-e "CONTENT_DIRNAME=./preview/docs" \
-e "CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD)"

# generate runs `go generate` to build the dynamically generated
# source files, except the protobuf stubs which are built instead with
@@ -26,23 +41,26 @@ staticcheck:
exhaustive:
@sh -c "'$(CURDIR)/scripts/exhaustive.sh'"

# Default: run this if working on the website locally to run in watch mode.
website:
@echo "==> Downloading latest Docker image..."
@docker pull hashicorp/terraform-website:full
@echo "==> Starting core website in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--workdir "/website" \
--volume "$(shell pwd):/website/ext/terraform" \
--publish "3000:3000" \
hashicorp/terraform-website:full \
npm start
@docker pull ${DOCKER_IMAGE}
@echo "==> Starting website in Docker..."
@docker run ${DOCKER_RUN_FLAGS} ${DOCKER_IMAGE} npm start

website/local:
@echo "==> Starting website in Docker..."
@docker run ${DOCKER_RUN_FLAGS} ${DOCKER_IMAGE_LOCAL} npm start

.PHONY: website/build-local
website/build-local:
@echo "==> Building local Docker image"
@docker build https://github.com/hashicorp/terraform-website.git\#master \
-t $(DOCKER_IMAGE_LOCAL)

# disallow any parallelism (-j) for Make. This is necessary since some
# commands during the build process create temporary files that collide
# under parallel conditions.
.NOTPARALLEL:

.PHONY: fmtcheck generate protobuf website website-test staticcheck
.PHONY: fmtcheck generate protobuf website website-test staticcheck website/local website/build-local
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2563bf3

Please sign in to comment.