From 5168a376bb979f0cbf2c24dd48ff66118d99b670 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Fri, 29 Nov 2024 16:33:31 +0000 Subject: [PATCH] Add `docker` and `run-docker` make targets. This enables testing the website locally as follows: 1. Run `make docker` 2. Run `make run-docker` 3. Navigate to http://localhost:5002 --- Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c1c01c31f..f224525c4 100644 --- a/Makefile +++ b/Makefile @@ -4,20 +4,31 @@ default: help .PHONY: help help: @echo "make help Show this help message" - @echo "make dev Run the pattern library app in a development server" @echo "make build Build the package" - @echo "make lint Run the code linter(s) and print any warnings" @echo "make checkformatting Check code formatting" + @echo "make clean Delete development artefacts (cached files etc.)" + @echo "make dev Run the pattern library app in a development server" + @echo "make docker Build Docker image for the website" @echo "make format Automatically format code" - @echo "make test Run the unit tests once" + @echo "make lint Run the code linter(s) and print any warnings" + @echo "make run-docker Run a Docker container using the image created by \`make docker\`" @echo "make sure Make sure that the formatter, linter, tests, etc all pass" - @echo "make clean Delete development artefacts (cached files, " - @echo " dependencies, etc)" + @echo "make test Run the unit tests once" .PHONY: dev dev: node_modules/.uptodate node_modules/.bin/gulp watch +.PHONY: docker +docker: + @git archive --format=tar.gz HEAD | docker build -t hypothesis/frontend-shared:latest - + +# Run Docker container. Publish to port 5002 on the host to avoid a conflict +# with other Hypothesis projects. +.PHONY: run-docker +run-docker: + @docker run --rm -p 5002:5001 --name hypothesis-frontend-shared hypothesis/frontend-shared:latest + .PHONY: test test: node_modules/.uptodate ifdef ARGS