2022-04-05 16:18:57 +00:00
|
|
|
.DEFAULT_GOAL := website
|
|
|
|
|
|
|
|
PWD=$$(pwd)
|
|
|
|
DOCKER_IMAGE="hashicorp/dev-portal"
|
|
|
|
DOCKER_IMAGE_LOCAL="dev-portal-local"
|
|
|
|
DOCKER_RUN_FLAGS=-it \
|
|
|
|
--publish "3000:3000" \
|
2020-04-06 20:27:35 +00:00
|
|
|
--rm \
|
|
|
|
--tty \
|
2022-04-05 16:18:57 +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-08-31 15:25:12 +00:00
|
|
|
-e "REPO=consul" \
|
|
|
|
-e "PREVIEW_MODE=developer"
|
2015-10-09 22:29:08 +00:00
|
|
|
|
2022-04-05 16:18:57 +00:00
|
|
|
# Default: run this if working on the website locally to run in watch mode.
|
|
|
|
.PHONY: website
|
|
|
|
website:
|
2020-04-06 20:27:35 +00:00
|
|
|
@echo "==> Downloading latest Docker image..."
|
2022-04-05 16:18:57 +00:00
|
|
|
@docker pull $(DOCKER_IMAGE)
|
|
|
|
@echo "==> Starting website..."
|
|
|
|
@docker run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE)
|
2017-04-04 16:33:32 +00:00
|
|
|
|
2022-04-05 16:18:57 +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..."
|
|
|
|
@docker run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE_LOCAL)
|
2020-04-06 20:27:35 +00:00
|
|
|
|
2022-04-05 16:18:57 +00:00
|
|
|
# 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/dev-portal.git\#main \
|
|
|
|
-t $(DOCKER_IMAGE_LOCAL)
|
2015-10-09 22:29:08 +00:00
|
|
|
|