2018-02-16 00:49:02 +00:00
|
|
|
IMAGE_NAME="alp-mdb"
|
2018-02-16 09:24:16 +00:00
|
|
|
CONTAINER_NAME="inst1"
|
2018-02-16 09:46:16 +00:00
|
|
|
LOG="/tmp/ptut.virtenv.log"
|
|
|
|
LOCK="/tmp/ptut.virtenv.lock"
|
2018-02-16 00:49:02 +00:00
|
|
|
|
2018-02-16 09:24:16 +00:00
|
|
|
image: build
|
2018-02-16 00:49:02 +00:00
|
|
|
@echo -n "> Building image...............";
|
|
|
|
docker build --force-rm -t $(IMAGE_NAME) . && echo "done" || echo "error";
|
|
|
|
|
2018-02-16 09:24:16 +00:00
|
|
|
build: docker/main docker/include/*
|
2018-02-16 00:49:02 +00:00
|
|
|
@echo -n "> Building file Dockerfile.....";
|
|
|
|
@cpp -o Dockerfile docker/main && echo "done" || echo "error";
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo -n "> Stopping containers..........";
|
2018-02-16 09:24:16 +00:00
|
|
|
@docker stop $(CONTAINER_NAME); true;
|
|
|
|
@docker rm -flv $(CONTAINER_NAME); true;
|
2018-02-16 00:49:02 +00:00
|
|
|
@echo -n "> Deleting docker image........";
|
2018-02-16 09:24:16 +00:00
|
|
|
@docker rmi -f $(IMAGE_NAME) && echo "done" || echo "failed"; true
|
2018-02-16 00:49:02 +00:00
|
|
|
@echo -n "> Deleting Dockerfile..........";
|
2018-02-16 09:24:16 +00:00
|
|
|
@rm Dockerfile && echo "done" || echo "failed"; true
|
|
|
|
|
|
|
|
run: image
|
|
|
|
@echo "> Launching the container";
|
|
|
|
docker run --name $(CONTAINER_NAME) $(IMAGE_NAME);
|
|
|
|
|
|
|
|
kill:
|
|
|
|
@docker exec -ti inst1 sh -c 'rm boot.lock';
|
2018-02-16 00:49:02 +00:00
|
|
|
|
|
|
|
boot:
|
2018-02-16 09:46:16 +00:00
|
|
|
@echo -e "/!\\ 'make log' for real-time log\n";
|
|
|
|
@touch $(LOG);
|
2018-02-16 00:49:02 +00:00
|
|
|
@while true; do \
|
2018-02-16 09:46:16 +00:00
|
|
|
echo "*** 1. Updating virtual environment" | tee -a $(LOG); \
|
|
|
|
git pull origin master >> $(LOG) 2>&1; true; \
|
|
|
|
echo "*** 2. Building image" | tee -a $(LOG); \
|
|
|
|
make image >> $(LOG) 2>&1; \
|
|
|
|
echo "*** 3. Launching container" | tee -a $(LOG); \
|
|
|
|
touch $(LOCK); \
|
|
|
|
docker run --name $(CONTAINER_NAME) $(IMAGE_NAME) >> $(LOG) 2>&1; \
|
|
|
|
echo "*** 4. Deleting container" | tee -a; \
|
|
|
|
docker stop $(CONTAINER_NAME) >> $(LOG) 2>&1; true; \
|
|
|
|
docker rm -flv $(CONTAINER_NAME) >> $(LOG) 2>&1; true; \
|
|
|
|
rm $(LOCK); \
|
2018-02-16 00:49:02 +00:00
|
|
|
sleep 2; \
|
2018-02-16 09:46:16 +00:00
|
|
|
done;
|
|
|
|
|
|
|
|
log:
|
|
|
|
@echo -n "> Checking log file.......";
|
|
|
|
@test -f $(LOG) && echo "found" || (echo "missing"; exit 1);
|
|
|
|
@echo -n "> Checking container......";
|
|
|
|
@test -f $(LOCK) && echo "running" || echo "not running";
|
|
|
|
@echo "====== LOG ======";
|
|
|
|
@tail -f $(LOG);
|
|
|
|
|
|
|
|
tty:
|
|
|
|
@echo -n "> Checking lock...........";
|
|
|
|
@test -f $(LOCK) && echo "found" || (echo "missing"; exit 1);
|
|
|
|
@echo "> Connecting tty.............";
|
|
|
|
@docker exec -ti $(CONTAINER_NAME) sh;
|