upg: makefile +upgraded makefile verbosity
This commit is contained in:
parent
994882a21f
commit
8ef603407c
66
Makefile
66
Makefile
|
@ -4,44 +4,62 @@ LOG="/tmp/ptut.virtenv.log"
|
||||||
LOCK="/tmp/ptut.virtenv.lock"
|
LOCK="/tmp/ptut.virtenv.lock"
|
||||||
|
|
||||||
image: build
|
image: build
|
||||||
@echo -n "> Building image...............";
|
@echo -n "> Build image..................";
|
||||||
docker build --force-rm -t $(IMAGE_NAME) . && echo "done" || echo "error";
|
@docker build --force-rm -t $(IMAGE_NAME) . >>$(LOG) 2>&1 && echo "done" || echo "error";
|
||||||
|
|
||||||
build: docker/main docker/include/*
|
build: docker/main docker/include/*
|
||||||
@echo -n "> Building file Dockerfile.....";
|
@echo -n "> Build Dockerfile.............";
|
||||||
@cpp -o Dockerfile docker/main && echo "done" || echo "error";
|
@cpp -o Dockerfile docker/main && echo "done" || echo "error";
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo -n "> Stopping containers..........";
|
@echo -n "> Stop container...............";
|
||||||
@docker stop $(CONTAINER_NAME); true;
|
@docker stop $(CONTAINER_NAME) >/dev/null 2>&1 && echo "stopped" || echo "already"; true;
|
||||||
@docker rm -flv $(CONTAINER_NAME); true;
|
@echo -n "> Delete container.............";
|
||||||
@echo -n "> Deleting docker image........";
|
@docker rm -f $(CONTAINER_NAME) >/dev/null 2>&1 && echo "deleted" || echo "already"; true;
|
||||||
@docker rmi -f $(IMAGE_NAME) && echo "done" || echo "failed"; true
|
@echo -n "> Delete image.................";
|
||||||
@echo -n "> Deleting Dockerfile..........";
|
@docker rmi -f $(IMAGE_NAME) >/dev/null 2>&1 && echo "deleted" || echo "already"; true;
|
||||||
@rm Dockerfile && echo "done" || echo "failed"; true
|
@echo -n "> Delete Dockerfile............";
|
||||||
|
@rm Dockerfile >/dev/null 2>&1 && echo "done" || echo "already"; true
|
||||||
|
@echo -n "> Delete log file..............";
|
||||||
|
@rm $(LOG) >/dev/null 2>&1 && echo "done" || echo "already"; true
|
||||||
|
@echo -n "> Delete lock file.............";
|
||||||
|
@rm $(LOCK) >/dev/null 2>&1 && echo "done" || echo "already"; true
|
||||||
|
|
||||||
run: image
|
run:
|
||||||
@echo "> Launching the container";
|
@echo ">>> Search running container";
|
||||||
docker run --name $(CONTAINER_NAME) $(IMAGE_NAME);
|
@test ! -f $(LOCK) && echo -e "<<< nothing\n" || (echo -e "<<< found\n\nERR: You must run 'make clean' before running a new container"; exit 1);
|
||||||
|
@echo ">>> Build image";
|
||||||
|
@make image;
|
||||||
|
@echo -e "<<< built\n";
|
||||||
|
@echo ">>> Container launched";
|
||||||
|
@touch $(LOCK);
|
||||||
|
@docker run --name $(CONTAINER_NAME) $(IMAGE_NAME);
|
||||||
|
@echo -e "<<< stopped\n";
|
||||||
|
@echo ">>> clean installation" | tee -a $(LOG); \
|
||||||
|
make clean;
|
||||||
|
@echo "<<< cleaned";
|
||||||
|
|
||||||
kill:
|
kill:
|
||||||
@docker exec -ti inst1 sh -c 'rm boot.lock';
|
@echo -n "Search running container.......";
|
||||||
|
@test -f $(LOCK) && echo "found" || (echo -e "nothing\n\nERR: You must run a container to kill it"; exit 1);
|
||||||
|
@echo -n "Kill container.................";
|
||||||
|
@docker exec -ti inst1 sh -c 'rm boot.lock' && echo "killed" || echo "error";
|
||||||
|
|
||||||
boot:
|
boot:
|
||||||
@echo -e "/!\\ 'make log' for real-time log\n";
|
|
||||||
@touch $(LOG);
|
@touch $(LOG);
|
||||||
@while true; do \
|
@while true; do \
|
||||||
echo "*** 1. Updating virtual environment" | tee -a $(LOG); \
|
echo ">>> pull from source" | tee -a $(LOG); \
|
||||||
git pull origin master >> $(LOG) 2>&1; true; \
|
git pull origin master >> $(LOG) 2>&1 && echo -e "<<< pulled\n" || echo -e "<<< error\n"; \
|
||||||
echo "*** 2. Building image" | tee -a $(LOG); \
|
echo ">>> make image" | tee -a $(LOG); \
|
||||||
make image >> $(LOG) 2>&1; \
|
make image; \
|
||||||
echo "*** 3. Launching container" | tee -a $(LOG); \
|
echo -e ">>> made\n" | tee -a $(LOG); \
|
||||||
|
echo ">>> launch container" | tee -a $(LOG); \
|
||||||
touch $(LOCK); \
|
touch $(LOCK); \
|
||||||
docker run --name $(CONTAINER_NAME) $(IMAGE_NAME) >> $(LOG) 2>&1; \
|
docker run --name $(CONTAINER_NAME) $(IMAGE_NAME) >> $(LOG) 2>&1; \
|
||||||
echo "*** 4. Deleting container" | tee -a; \
|
echo -e "<<< stopped\n" | tee -a $(LOG); \
|
||||||
docker stop $(CONTAINER_NAME) >> $(LOG) 2>&1; true; \
|
echo ">>> clean installation" | tee -a $(LOG); \
|
||||||
docker rm -flv $(CONTAINER_NAME) >> $(LOG) 2>&1; true; \
|
make clean; \
|
||||||
rm $(LOCK); \
|
echo -e "<<< cleaned\n"; \
|
||||||
sleep 2; \
|
sleep 2; \
|
||||||
done;
|
done;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue