upd: makefile +added run ~renamed Dockerfile->build ~renamed build->image *fixed things

This commit is contained in:
xdrm-brackets 2018-02-16 10:24:16 +01:00
parent 6a5e70ccf2
commit 0f9beddeb5
1 changed files with 20 additions and 15 deletions

View File

@ -1,35 +1,40 @@
IMAGE_NAME="alp-mdb" IMAGE_NAME="alp-mdb"
CONTAINER_NAME="inst1"
build: clean Dockerfile image: build
@echo -n "> Building image..............."; @echo -n "> Building image...............";
docker build --force-rm -t $(IMAGE_NAME) . && echo "done" || echo "error"; docker build --force-rm -t $(IMAGE_NAME) . && echo "done" || echo "error";
Dockerfile: docker/main docker/include/* build: docker/main docker/include/*
@echo -n "> Building file Dockerfile....."; @echo -n "> Building file 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 "> Stopping containers..........";
@docker stop inst1; @docker stop $(CONTAINER_NAME); true;
@docker rm -flv inst1; @docker rm -flv $(CONTAINER_NAME); true;
@echo -n "> Deleting docker image........"; @echo -n "> Deleting docker image........";
@docker rmi -f $(IMAGE_NAME) && echo "done" || echo "failed"; @docker rmi -f $(IMAGE_NAME) && echo "done" || echo "failed"; true
@echo -n "> Deleting Dockerfile.........."; @echo -n "> Deleting Dockerfile..........";
@rm Dockerfile && echo "done" || echo "failed"; @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';
boot: boot:
@while true; do \ @while true; do \
echo "*** 1. Updating virtual environment"; \ echo "*** 1. Updating virtual environment"; \
git pull origin stable; \ git pull; \
echo "*** 2. Building image"; \ echo "*** 2. Building image"; \
make build; \ make image; \
echo "*** 3. Launching container"; \ echo "*** 3. Launching container"; \
docker run --name inst1 $(IMAGE_NAME); \ docker run --name $(CONTAINER_NAME) $(IMAGE_NAME); \
echo "*** 4. Deleting container"; \ echo "*** 4. Deleting container"; \
docker stop inst1; \ docker stop $(CONTAINER_NAME); \
docker rm -flv inst1; \ docker rm -flv $(CONTAINER_NAME); \
sleep 2; \ sleep 2; \
done; done;
kill:
@docker exec -ti inst1 sh -c 'rm boot.lock';