2022-10-18 16:36:24 +00:00
|
|
|
######################################################
|
|
|
|
# NOTE: This file is managed by the Digital Team's #
|
|
|
|
# Terraform configuration @ hashicorp/mktg-terraform #
|
|
|
|
######################################################
|
|
|
|
|
2022-05-05 14:53:22 +00:00
|
|
|
.DEFAULT_GOAL := website
|
|
|
|
|
2022-10-18 16:36:24 +00:00
|
|
|
# Set the preview mode for the website shell to "developer" or "io"
|
|
|
|
PREVIEW_MODE ?= developer
|
|
|
|
REPO ?= nomad
|
|
|
|
|
2022-07-26 14:15:03 +00:00
|
|
|
# Enable setting alternate docker tool, e.g. 'make DOCKER_CMD=podman'
|
|
|
|
DOCKER_CMD ?= docker
|
|
|
|
|
2022-10-18 16:36:24 +00:00
|
|
|
CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
LOCAL_CONTENT_DIR=
|
2022-05-05 14:53:22 +00:00
|
|
|
PWD=$$(pwd)
|
2022-10-18 16:36:24 +00:00
|
|
|
|
2022-05-05 14:53:22 +00:00
|
|
|
DOCKER_IMAGE="hashicorp/dev-portal"
|
|
|
|
DOCKER_IMAGE_LOCAL="dev-portal-local"
|
|
|
|
DOCKER_RUN_FLAGS=-it \
|
|
|
|
--publish "3000:3000" \
|
2020-02-06 23:45:31 +00:00
|
|
|
--rm \
|
|
|
|
--tty \
|
2022-05-05 14:53:22 +00:00
|
|
|
--volume "$(PWD)/content:/app/content" \
|
|
|
|
--volume "$(PWD)/public:/app/public" \
|
|
|
|
--volume "$(PWD)/data:/app/data" \
|
|
|
|
--volume "$(PWD)/redirects.js:/app/redirects.js" \
|
|
|
|
--volume "next-dir:/app/website-preview/.next" \
|
|
|
|
--volume "$(PWD)/.env:/app/.env" \
|
2022-10-18 16:36:24 +00:00
|
|
|
-e "REPO=$(REPO)" \
|
|
|
|
-e "PREVIEW_FROM_REPO=$(REPO)" \
|
|
|
|
-e "IS_CONTENT_PREVIEW=true" \
|
|
|
|
-e "LOCAL_CONTENT_DIR=$(LOCAL_CONTENT_DIR)" \
|
|
|
|
-e "CURRENT_GIT_BRANCH=$(CURRENT_GIT_BRANCH)" \
|
|
|
|
-e "PREVIEW_MODE=$(PREVIEW_MODE)"
|
2015-10-13 21:50:23 +00:00
|
|
|
|
2022-05-05 14:53:22 +00:00
|
|
|
# Default: run this if working on the website locally to run in watch mode.
|
|
|
|
.PHONY: website
|
|
|
|
website:
|
2020-02-06 23:45:31 +00:00
|
|
|
@echo "==> Downloading latest Docker image..."
|
2022-07-26 14:15:03 +00:00
|
|
|
@$(DOCKER_CMD) pull $(DOCKER_IMAGE)
|
2022-05-05 14:53:22 +00:00
|
|
|
@echo "==> Starting website..."
|
2022-07-26 14:15:03 +00:00
|
|
|
@$(DOCKER_CMD) run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE)
|
2017-04-06 22:37:36 +00:00
|
|
|
|
2022-05-05 14:53:22 +00:00
|
|
|
# Use this if you have run `website/build-local` to use the locally built image.
|
|
|
|
.PHONY: website/local
|
|
|
|
website/local:
|
|
|
|
@echo "==> Starting website from local image..."
|
2022-07-26 14:15:03 +00:00
|
|
|
@$(DOCKER_CMD) run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE_LOCAL)
|
2020-02-06 23:45:31 +00:00
|
|
|
|
2022-05-05 14:53:22 +00:00
|
|
|
# Run this to generate a new local Docker image.
|
|
|
|
.PHONY: website/build-local
|
|
|
|
website/build-local:
|
|
|
|
@echo "==> Building local Docker image"
|
2022-07-26 14:15:03 +00:00
|
|
|
@$(DOCKER_CMD) build https://github.com/hashicorp/dev-portal.git\#main \
|
2022-05-05 14:53:22 +00:00
|
|
|
-t $(DOCKER_IMAGE_LOCAL)
|
2018-10-08 18:44:23 +00:00
|
|
|
|