dev: clean and fix Makefile

This commit is contained in:
mcolonna 2025-06-16 15:23:52 +02:00
parent 2eb686ef41
commit 2d673aa016

View file

@ -1,6 +1,5 @@
# TODO(vm) data is supposed to be in $HOME/data/
WWW_PATH=__www/ # TODO to change
BUILD_PATH=__build/
DOCKER=docker
@ -9,7 +8,7 @@ SRC_WWW_MORE=srcs/www/
.ONESHELL :
.SHELLFLAGS = -eu -c
.PHONY : run uninstall debug re help shell
.PHONY : run reset re help
### pretty logs ####
@ -28,48 +27,33 @@ run :
echoo "Running '$(SRC_COMPOSE)'..."
cd -- $(SRC_COMPOSE)
INCEPTION_WWW_PATH="$(shell realpath $(WWW_PATH))" $(DOCKER) compose up --build
$(DOCKER) compose up --build
cd -
## Remove WWW_PATH.
uninstall :
## Remove all content of the website.
reset :
@$(_ECHO)
echoo "Removing $(WWW_PATH)..."
rm -r $(WWW_PATH) || true
# TODO(ugly)
docker container prune
docker volume rm my-awesome-compose_db || true
docker volume rm my-awesome-compose_www || true
echoo "Removing all data..."
cd -- $(SRC_COMPOSE)
docker compose down -v
cd -
## 'uninstall' then 'install'
re : uninstall run
## 'reset' then 'run'
re : reset run
@$(_ECHO)
echo
echo "run \`make\` or \`make run\` to run the docker."
## TODO docs
shell :
@$(_ECHO)
echoo "Running shell inside '$(SRC_COMPOSE)' (container nginx)..."
cd -- $(SRC_COMPOSE)
INCEPTION_WWW_PATH="$(shell realpath $(WWW_PATH))" $(DOCKER) compose run --build nginx sh
## Show help
help :
@$(_ECHO)
echo
echo "run Run the compose, install WWW_PATH if necessary."
echo "uninstall TODO"
echo "re 'uninstall' then 'run'."
# TODO docs shell
echo
echo "WWW_PATH is the volume directory where WordPress is installed."
echo "you might want to reset the WWW_PATH variable in the Makefile."
echo "run Run the compose."
echo "reset Remove all content of the website."
echo "re 'reset' then 'run'."
echo