add: wordpress docker

This commit is contained in:
mcolonna 2025-06-09 15:37:05 +02:00
parent 2484c20af5
commit aa2a0d6f71
11 changed files with 137 additions and 159 deletions

View file

@ -1,11 +1,14 @@
# TODO(vm) data is supposed to be in $HOME/data/
WWW_PATH=__www/ # TODO to change
BUILD_PATH=__build/
DOCKER=docker
SRC_COMPOSE=srcs/
.ONESHELL :
.SHELLFLAGS = -eu -c
.PHONY : run help
.PHONY : run install uninstall debug re help shell
### pretty logs ####
@ -19,25 +22,71 @@ _ECHO = echoo(){ \
## Run the compose.
run :
run : $(WWW_PATH)
@$(_ECHO)
echoo "Running '$(SRC_COMPOSE)'..."
echo "$ cd -- $(SRC_COMPOSE)"
cd -- $(SRC_COMPOSE)
echo "$ $(DOCKER) compose up --build"
$(DOCKER) compose up --build
INCEPTION_WWW_PATH="$(shell realpath $(WWW_PATH))" $(DOCKER) compose up --build
## Run the compose with debug flags.
debug :
$(MAKE) DEBUG=yes run
## Create WWW_PATH from wordpress' release.
install : $(WWW_PATH)
$(WWW_PATH) :
@$(_ECHO)
echoo "Creating $(WWW_PATH) directory from wordpress release..."
rm -rf $(BUILD_PATH)
# download and uncompress release
mkdir -p $(BUILD_PATH)"/www/"
curl https://wordpress.org/latest.tar.gz | tar zx -C $(BUILD_PATH)/www
# move in WWW_PATH
rm -rf -- $(WWW_PATH)
mv $(BUILD_PATH)"/www/wordpress" $(WWW_PATH)
rm -rf $(BUILD_PATH)
## Remove WWW_PATH.
uninstall :
@$(_ECHO)
echoo "Removing $(WWW_PATH)..."
rm -r $(WWW_PATH) || true
## 'uninstall' then 'install'
re : uninstall install
@$(_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 "run Run the compose."
echo "debug Run the compose with debug flags."
echo "That's all lol"
echo
echo "run Run the compose, install WWW_PATH if necessary."
echo "install Create WWW_PATH from wordpress' release."
echo "uninstall Remove WWW_PATH."
echo "re 'uninstall' then 'install'."
# 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