75 lines
1.4 KiB
Makefile
75 lines
1.4 KiB
Makefile
# TODO(vm) data is supposed to be in $HOME/data/
|
|
|
|
WWW_PATH=__www/ # TODO to change
|
|
BUILD_PATH=__build/
|
|
|
|
DOCKER=docker
|
|
SRC_COMPOSE=srcs/
|
|
SRC_WWW_MORE=srcs/www/
|
|
|
|
.ONESHELL :
|
|
.SHELLFLAGS = -eu -c
|
|
.PHONY : run uninstall debug re help shell
|
|
|
|
### pretty logs ####
|
|
|
|
_ECHO = echoo(){ \
|
|
if [ -t 1 ]; then \
|
|
echo "\e[30;47;1m$$*\e[0m"; \
|
|
else \
|
|
echo "$$*"; \
|
|
fi; \
|
|
}
|
|
|
|
|
|
## Run the compose.
|
|
run :
|
|
@$(_ECHO)
|
|
|
|
echoo "Running '$(SRC_COMPOSE)'..."
|
|
cd -- $(SRC_COMPOSE)
|
|
INCEPTION_WWW_PATH="$(shell realpath $(WWW_PATH))" $(DOCKER) compose up --build
|
|
|
|
|
|
## Remove WWW_PATH.
|
|
uninstall :
|
|
@$(_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
|
|
|
|
|
|
## 'uninstall' then 'install'
|
|
re : uninstall 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
|