github.com/pulumi/terraform@v1.4.0/website/Makefile (about) 1 ###################################################### 2 # NOTE: This file is managed by the Digital Team's # 3 # Terraform configuration @ hashicorp/mktg-terraform # 4 ###################################################### 5 6 .DEFAULT_GOAL := website 7 8 # Set the preview mode for the website shell to "developer" or "io" 9 PREVIEW_MODE ?= developer 10 REPO ?= terraform 11 12 # Enable setting alternate docker tool, e.g. 'make DOCKER_CMD=podman' 13 DOCKER_CMD ?= docker 14 15 CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD) 16 LOCAL_CONTENT_DIR=../docs 17 PWD=$$(pwd) 18 19 DOCKER_IMAGE="hashicorp/dev-portal" 20 DOCKER_IMAGE_LOCAL="dev-portal-local" 21 DOCKER_RUN_FLAGS=-it \ 22 --publish "3000:3000" \ 23 --rm \ 24 --tty \ 25 --volume "$(PWD)/docs:/app/docs" \ 26 --volume "$(PWD)/img:/app/public" \ 27 --volume "$(PWD)/data:/app/data" \ 28 --volume "$(PWD)/redirects.js:/app/redirects.js" \ 29 --volume "next-dir:/app/website-preview/.next" \ 30 --volume "$(PWD)/.env:/app/.env" \ 31 --volume "$(PWD)/.env.development:/app/website-preview/.env.development" \ 32 --volume "$(PWD)/.env.local:/app/website-preview/.env.local" \ 33 -e "REPO=$(REPO)" \ 34 -e "PREVIEW_FROM_REPO=$(REPO)" \ 35 -e "IS_CONTENT_PREVIEW=true" \ 36 -e "LOCAL_CONTENT_DIR=$(LOCAL_CONTENT_DIR)" \ 37 -e "CURRENT_GIT_BRANCH=$(CURRENT_GIT_BRANCH)" \ 38 -e "PREVIEW_MODE=$(PREVIEW_MODE)" 39 40 # Default: run this if working on the website locally to run in watch mode. 41 .PHONY: website 42 website: 43 @echo "==> Downloading latest Docker image..." 44 @$(DOCKER_CMD) pull $(DOCKER_IMAGE) 45 @echo "==> Starting website..." 46 @$(DOCKER_CMD) run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE) 47 48 # Use this if you have run `website/build-local` to use the locally built image. 49 .PHONY: website/local 50 website/local: 51 @echo "==> Starting website from local image..." 52 @$(DOCKER_CMD) run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE_LOCAL) 53 54 # Run this to generate a new local Docker image. 55 .PHONY: website/build-local 56 website/build-local: 57 @echo "==> Building local Docker image" 58 @$(DOCKER_CMD) build https://github.com/hashicorp/dev-portal.git\#main \ 59 -t $(DOCKER_IMAGE_LOCAL) 60