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
|
DOCKER=docker
|
||||||
SRC_DATA=data/
|
|
||||||
SRC_COMPOSE=srcs/
|
SRC_COMPOSE=srcs/
|
||||||
OUT_DATA=$(HOME)/inception_data # TODO to change
|
|
||||||
|
|
||||||
.ONESHELL :
|
.ONESHELL :
|
||||||
.SHELLFLAGS = -eu -c
|
.SHELLFLAGS = -eu -c
|
||||||
.PHONY : all run re data_install data_remove data_reinstall help
|
.PHONY : run help
|
||||||
|
|
||||||
### pretty logs ####
|
### 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 the compose.
|
||||||
run :
|
run :
|
||||||
@$(_ECHO)
|
@$(_ECHO)
|
||||||
|
@ -32,50 +25,19 @@ run :
|
||||||
echoo "Running '$(SRC_COMPOSE)'..."
|
echoo "Running '$(SRC_COMPOSE)'..."
|
||||||
echo "$ cd -- $(SRC_COMPOSE)"
|
echo "$ cd -- $(SRC_COMPOSE)"
|
||||||
cd -- $(SRC_COMPOSE)
|
cd -- $(SRC_COMPOSE)
|
||||||
echo "$ DATA=$(OUT_DATA) docker compose up --build"
|
echo "$ $(DOCKER) compose up --build"
|
||||||
DATA=$(OUT_DATA) docker compose up --build
|
$(DOCKER) compose up --build
|
||||||
|
|
||||||
|
|
||||||
## Reinstall the data then run it again.
|
## Run the compose with debug flags.
|
||||||
re : data_reinstall run
|
debug :
|
||||||
|
$(MAKE) DEBUG=yes 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
|
## Show help
|
||||||
help :
|
help :
|
||||||
@$(_ECHO)
|
@$(_ECHO)
|
||||||
|
|
||||||
echo "all Run the compose, installing the necessary data if necessary."
|
echo "run Run the compose."
|
||||||
echo "run Run the compose."
|
echo "debug Run the compose with debug flags."
|
||||||
echo "re Reinstall the data then run it again."
|
echo "That's all lol"
|
||||||
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"
|
|
||||||
|
|
|
@ -3,11 +3,9 @@ name: my-awesome-compose
|
||||||
services:
|
services:
|
||||||
nginx:
|
nginx:
|
||||||
# TODO no latest??
|
# TODO no latest??
|
||||||
image: nginx:latest
|
build: ./requirements/nginx/
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 8080:80
|
||||||
volumes:
|
|
||||||
- ${DATA:?error}/nginx/www/:/usr/share/nginx/html:ro
|
|
||||||
|
|
||||||
### services ###
|
### services ###
|
||||||
# image:
|
# image:
|
|
@ -1 +1,2 @@
|
||||||
|
/Dockerfile
|
||||||
/.dockerignore
|
/.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