Skip to content

Commit

Permalink
chore: update root Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
thiskevinwang authored and DanielMSchmidt committed Oct 25, 2022
1 parent 81a591c commit 328861c
Showing 1 changed file with 8 additions and 25 deletions.
33 changes: 8 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
PWD=$$(pwd)
DOCKER_IMAGE="hashicorp/terraform-website:full"
DOCKER_IMAGE_LOCAL="terraform-website-local"
DOCKER_RUN_FLAGS=--interactive \
--rm \
--tty \
--volume "$(shell pwd)/website:/website/preview" \
--publish "3000:3000" \
-e "IS_CONTENT_PREVIEW=true" \
-e "PREVIEW_FROM_REPO=terraform-cdk" \
-e "NAV_DATA_DIRNAME=./preview/data" \
-e "CONTENT_DIRNAME=./preview/docs" \
-e "CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD)"
.DEFAULT_GOAL := website

# Default: run this if working on the website locally to run in watch mode.
.PHONY: website
website:
@echo "==> Downloading latest Docker image..."
@docker pull ${DOCKER_IMAGE}
@echo "==> Starting website in Docker..."
@docker run ${DOCKER_RUN_FLAGS} ${DOCKER_IMAGE} npm start
$(MAKE) -C website website

# Use this if you have run `website/build-local` to use the locally built image.
.PHONY: website/local
website/local:
@echo "==> Starting website in Docker..."
@docker run ${DOCKER_RUN_FLAGS} ${DOCKER_IMAGE_LOCAL} npm start
$(MAKE) -C website website/local

# Run this to generate a new local Docker image.
.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)

.DEFAULT_GOAL := website
.PHONY: website website/local website/build-local
$(MAKE) -C website website/build-local

0 comments on commit 328861c

Please sign in to comment.