diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b55a3bf --- /dev/null +++ b/Makefile @@ -0,0 +1,81 @@ +DOCKER=docker +SRC_DATA=data/ +SRC_COMPOSE=srcs/ +OUT_DATA=$(HOME)/inception_data # TODO to change + +.ONESHELL : +.SHELLFLAGS = -eu -c +.PHONY : all run re data_install data_remove data_reinstall help + +### pretty logs #### + +_ECHO = echoo(){ \ + if [ -t 1 ]; then \ + echo "\e[30;47;1m$$*\e[0m"; \ + else \ + echo "$$*"; \ + fi; \ +} + + +### rules ### + + +## Run the compose, installing the necessary data if necessary. +all : data_install run + + +## Run the compose. +run : + @$(_ECHO) + + echoo "Running '$(SRC_COMPOSE)'..." + echo "$ cd -- $(SRC_COMPOSE)" + cd -- $(SRC_COMPOSE) + echo "$ DATA=$(OUT_DATA) docker compose up --build" + DATA=$(OUT_DATA) docker compose up --build + + +## Reinstall the data then run it again. +re : data_reinstall run + + +## Install the necessary data if the directory doesn't exist yet. +data_install : + @$(_ECHO) + + echoo "Copy '$(SRC_DATA)' to '$(OUT_DATA)'..." + if [ -d $(OUT_DATA) ]; then + echo "'$(OUT_DATA)' already exists." + else + echo "$ cp -r -- $(SRC_DATA) $(OUT_DATA)" + cp -r -- $(SRC_DATA) $(OUT_DATA) + echo "$ chmod -R 0777 -- $(OUT_DATA)" + chmod -R 0777 -- $(OUT_DATA) + fi + + +## Remove the necessary data.. +data_remove : + @$(_ECHO) + + echoo "Remove '$(OUT_DATA)'..." + echo "$ rm -rf -- $(OUT_DATA)" + rm -rf -- $(OUT_DATA) + + +## Remove then reinstall the necessary data. +data_reinstall : data_remove data_install + + +## Show help +help : + @$(_ECHO) + + echo "all Run the compose, installing the necessary data if necessary." + echo "run Run the compose." + echo "re Reinstall the data then run it again." + echo "data_install Install the necessary data." + echo "data_remove Remove the compose data." + echo "data_reinstall Remove then reinstall the necessary data." + echo "help this lol" diff --git a/data/nginx/www/VarelaRound.ttf b/data/nginx/www/VarelaRound.ttf new file mode 100644 index 0000000..9d01812 Binary files /dev/null and b/data/nginx/www/VarelaRound.ttf differ diff --git a/data/nginx/www/index.html b/data/nginx/www/index.html new file mode 100644 index 0000000..b2e6085 --- /dev/null +++ b/data/nginx/www/index.html @@ -0,0 +1,144 @@ + + + + + + yippee + + + +
yippee
+
yippee
+
yippee
+ + diff --git a/srcs/compose.yaml b/srcs/compose.yaml index 403a393..6fa4403 100644 --- a/srcs/compose.yaml +++ b/srcs/compose.yaml @@ -6,6 +6,8 @@ services: image: nginx:latest ports: - 8080:80 + volumes: + - ${DATA:?error}/nginx/www/:/usr/share/nginx/html:ro ### services ### # image: