From 6d71d47441d32b39d0b6656a07efa52512b2da33 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Thu, 25 Mar 2021 20:56:54 -0400 Subject: [PATCH] Add make npm xxx & make composer xxx commands Signed-off-by: Andrew Welch --- Makefile | 11 +++++++++-- README.md | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3625c75..b516e0c 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,20 @@ CONTAINER?=$(shell basename $(CURDIR))_php_1 +BUILDCHAIN?=$(shell basename $(CURDIR))_webpack_1 -.PHONY: build clean dev pulldb restoredb up +.PHONY: build clean composer dev npm pulldb restoredb up build: up - cd scripts/ && ./docker_prod_build.sh + docker exec -it ${BUILDCHAIN} npm run build clean: docker-compose down -v docker-compose up --build +composer: up + docker exec -it ${CONTAINER} composer \ + $(filter-out $@,$(MAKECMDGOALS)) dev: up +npm: up + docker exec -it ${BUILDCHAIN} npm \ + $(filter-out $@,$(MAKECMDGOALS)) pulldb: up cd scripts/ && ./docker_pull_db.sh restoredb: up diff --git a/README.md b/README.md index 12b5413..77c1fdf 100644 --- a/README.md +++ b/README.md @@ -77,10 +77,12 @@ This project uses Docker to shrink-wrap the devops it needs to run around the pr To make using it easier, we're using a Makefile and the built-in `make` utility to create local aliases. You can run the following from terminal in the project directory: - `make dev` - starts up the local dev server listening on `http://localhost:8000/` -- `make build` - builds the static assets via the webpack 5 buildchain, to the `cms/web/dist/` directory; the `scripts/.env.sh` must be set up first +- `make build` - builds the static assets via the webpack 5 buildchain - `make clean` - shuts down the Docker containers, removes any mounted volumes (including the database), and then rebuilds the containers from scratch +- `make composer xxx` - runs the `composer` command passed in, e.g. `make composer install` +- `make npm xxx` - runs the `npm` command passed in, e.g. `make npm install` - `make pulldb` - runs the `scripts/docker_pull_db.sh` script to pull a remote database into the database container; the `scripts/.env.sh` must be set up first -- `make restoredb xxxx` - runs the `scripts/docker_restore_db.sh` script to restore a local database dump into the database container; the `scripts/.env.sh` must be set up first +- `make restoredb xxx` - runs the `scripts/docker_restore_db.sh` script to restore a local database dump into the database container; the `scripts/.env.sh` must be set up first ### Other notes