-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
website: fix usages of img tag (#14910)
* fix usages of img tag and integrate dev-portal workflows * Adjust Makefile
- Loading branch information
Bryce Kalow
committed
Apr 5, 2022
1 parent
4cffe22
commit c5b87f0
Showing
8 changed files
with
119 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,38 @@ | ||
# Default: run this if working on the website locally to run in watch mode. | ||
website: | ||
@echo "==> Downloading latest Docker image..." | ||
@docker pull hashicorp/vault-website | ||
@echo "==> Starting website in Docker..." | ||
@docker run \ | ||
--interactive \ | ||
.DEFAULT_GOAL := website | ||
|
||
PWD=$$(pwd) | ||
DOCKER_IMAGE="hashicorp/dev-portal" | ||
DOCKER_IMAGE_LOCAL="dev-portal-local" | ||
DOCKER_RUN_FLAGS=-it \ | ||
--publish "3000:3000" \ | ||
--rm \ | ||
--tty \ | ||
--workdir "/website" \ | ||
--volume "$(shell pwd):/website" \ | ||
--volume "/website/node_modules" \ | ||
--publish "3000:3000" \ | ||
hashicorp/vault-website \ | ||
npm start | ||
--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" \ | ||
-e "REPO=vault" | ||
|
||
# This command will generate a static version of the website to the "out" folder. | ||
build: | ||
# Default: run this if working on the website locally to run in watch mode. | ||
.PHONY: website | ||
website: | ||
@echo "==> Downloading latest Docker image..." | ||
@docker pull hashicorp/vault-website | ||
@echo "==> Starting build in Docker..." | ||
@docker run \ | ||
--interactive \ | ||
--rm \ | ||
--tty \ | ||
--workdir "/website" \ | ||
--volume "$(shell pwd):/website" \ | ||
--volume "/website/node_modules" \ | ||
hashicorp/vault-website \ | ||
npm run static | ||
@docker pull $(DOCKER_IMAGE) | ||
@echo "==> Starting website..." | ||
@docker run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE) | ||
|
||
# If you are changing node dependencies locally, run this to generate a new | ||
# local Docker image with the dependency changes included. | ||
build-image: | ||
@echo "==> Building Docker image..." | ||
@docker build -t hashicorp-vault-website-local . | ||
# 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) | ||
|
||
# Use this if you have run `build-image` to use the locally built image | ||
# rather than our CI-generated image to test dependency changes. | ||
website-local: | ||
@echo "==> Downloading latest Docker image..." | ||
@docker pull hashicorp/vault-website | ||
@echo "==> Starting website in Docker..." | ||
@docker run \ | ||
--interactive \ | ||
--rm \ | ||
--tty \ | ||
--workdir "/website" \ | ||
--volume "$(shell pwd):/website" \ | ||
--volume "/website/node_modules" \ | ||
--publish "3000:3000" \ | ||
hashicorp-vault-website-local \ | ||
npm start | ||
# 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) | ||
|
||
.DEFAULT_GOAL := website | ||
.PHONY: build build-image website website-local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Repo which we are cloning and executing npm run build:deploy-preview within | ||
REPO_TO_CLONE=dev-portal | ||
# Set the subdirectory name for the base project | ||
PREVIEW_DIR=website-preview | ||
# The directory we want to clone the project into | ||
CLONE_DIR=website-preview | ||
# The product for which we are building the deploy preview | ||
PRODUCT=vault | ||
|
||
from_cache=false | ||
|
||
if [ -d "$PREVIEW_DIR" ]; then | ||
echo "$PREVIEW_DIR found" | ||
CLONE_DIR="$PREVIEW_DIR-tmp" | ||
from_cache=true | ||
fi | ||
|
||
# Clone the base project, if needed | ||
echo "⏳ Cloning the $REPO_TO_CLONE repo, this might take a while..." | ||
git clone --depth=1 "/~https://github.com/hashicorp/$REPO_TO_CLONE.git" "$CLONE_DIR" | ||
|
||
if [ "$from_cache" = true ]; then | ||
echo "Setting up $PREVIEW_DIR" | ||
cp -R "./$CLONE_DIR/." "./$PREVIEW_DIR" | ||
fi | ||
|
||
# cd into the preview directory project | ||
cd "$PREVIEW_DIR" | ||
|
||
# Run the build:deploy-preview start script | ||
REPO=$PRODUCT DEV_IO=$PRODUCT IS_CONTENT_PREVIEW=true HASHI_ENV=project-preview npm run build:deploy-preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Repo which we are cloning and executing npm run build:deploy-preview within | ||
REPO_TO_CLONE=dev-portal | ||
# Set the subdirectory name for the dev-portal app | ||
PREVIEW_DIR=website-preview | ||
# The product for which we are building the deploy preview | ||
PRODUCT=vault | ||
|
||
should_pull=true | ||
|
||
# Clone the dev-portal project, if needed | ||
if [ ! -d "$PREVIEW_DIR" ]; then | ||
echo "⏳ Cloning the $REPO_TO_CLONE repo, this might take a while..." | ||
git clone --depth=1 /~https://github.com/hashicorp/$REPO_TO_CLONE.git "$PREVIEW_DIR" | ||
should_pull=false | ||
fi | ||
|
||
cd "$PREVIEW_DIR" | ||
|
||
# If the directory already existed, pull to ensure the clone is fresh | ||
if [ "$should_pull" = true ]; then | ||
git pull origin main | ||
fi | ||
|
||
# Run the dev-portal content-repo start script | ||
REPO=$PRODUCT PREVIEW_DIR="$PREVIEW_DIR" npm run start:local-preview |