dev: reorganize
This commit is contained in:
parent
5d72cc8d48
commit
e406e26b4d
6 changed files with 21 additions and 53 deletions
60
Makefile
60
Makefile
|
@ -1,11 +1,11 @@
|
|||
# TODO data is supposed to be in $HOME/data/
|
||||
|
||||
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
|
||||
.PHONY : run help
|
||||
|
||||
### pretty logs ####
|
||||
|
||||
|
@ -18,13 +18,6 @@ _ECHO = echoo(){ \
|
|||
}
|
||||
|
||||
|
||||
### rules ###
|
||||
|
||||
|
||||
## Run the compose, installing the necessary data if necessary.
|
||||
all : data_install run
|
||||
|
||||
|
||||
## Run the compose.
|
||||
run :
|
||||
@$(_ECHO)
|
||||
|
@ -32,50 +25,19 @@ run :
|
|||
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
|
||||
echo "$ $(DOCKER) compose up --build"
|
||||
$(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
|
||||
## Run the compose with debug flags.
|
||||
debug :
|
||||
$(MAKE) DEBUG=yes run
|
||||
|
||||
|
||||
## 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"
|
||||
echo "run Run the compose."
|
||||
echo "debug Run the compose with debug flags."
|
||||
echo "That's all lol"
|
||||
|
|
|
@ -3,11 +3,9 @@ name: my-awesome-compose
|
|||
services:
|
||||
nginx:
|
||||
# TODO no latest??
|
||||
image: nginx:latest
|
||||
build: ./requirements/nginx/
|
||||
ports:
|
||||
- 80:80
|
||||
volumes:
|
||||
- ${DATA:?error}/nginx/www/:/usr/share/nginx/html:ro
|
||||
- 8080:80
|
||||
|
||||
### services ###
|
||||
# image:
|
|
@ -1 +1,2 @@
|
|||
/Dockerfile
|
||||
/.dockerignore
|
7
srcs/requirements/nginx/Dockerfile
Normal file
7
srcs/requirements/nginx/Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
|||
# TODO no latest
|
||||
FROM nginx:latest
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
RUN rm -r /usr/share/nginx/html
|
||||
COPY www /usr/share/nginx/html
|
Loading…
Add table
Reference in a new issue