40 lines
1.2 KiB
Makefile
40 lines
1.2 KiB
Makefile
IMAGE_NAME="alp-mdb"
|
|
CONTAINER_NAME="inst1"
|
|
|
|
image: build
|
|
@echo -n "> Building image...............";
|
|
docker build --force-rm -t $(IMAGE_NAME) . && echo "done" || echo "error";
|
|
|
|
build: docker/main docker/include/*
|
|
@echo -n "> Building file Dockerfile.....";
|
|
@cpp -o Dockerfile docker/main && echo "done" || echo "error";
|
|
|
|
clean:
|
|
@echo -n "> Stopping containers..........";
|
|
@docker stop $(CONTAINER_NAME); true;
|
|
@docker rm -flv $(CONTAINER_NAME); true;
|
|
@echo -n "> Deleting docker image........";
|
|
@docker rmi -f $(IMAGE_NAME) && echo "done" || echo "failed"; true
|
|
@echo -n "> Deleting Dockerfile..........";
|
|
@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:
|
|
@while true; do \
|
|
echo "*** 1. Updating virtual environment"; \
|
|
git pull; \
|
|
echo "*** 2. Building image"; \
|
|
make image; \
|
|
echo "*** 3. Launching container"; \
|
|
docker run --name $(CONTAINER_NAME) $(IMAGE_NAME); \
|
|
echo "*** 4. Deleting container"; \
|
|
docker stop $(CONTAINER_NAME); \
|
|
docker rm -flv $(CONTAINER_NAME); \
|
|
sleep 2; \
|
|
done;
|