forked from frdmn/docker-cloudbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
31 lines (25 loc) · 1.05 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
AUTHOR = frdmn
NAME = docker-cloudbot
VERSION = 1.0.0
SHELL := /bin/bash
.PHONY: all build
all: build run
build:
docker build --no-cache -t "$(AUTHOR)/$(NAME):$(VERSION)" .
stop:
@if [[ "$(shell docker inspect -f {{.State.Running}} "$(NAME)" 2> /dev/null)" == "true" ]]; then \
printf "INFO: Stopping running container '$(NAME)' ..."; \
docker stop "$(NAME)" &> /dev/null && printf " done!\n" || printf " failed!\n"; \
else \
printf "WARN: container '$(NAME)' is not running.\n"; \
fi
remove:
@if [[ "$(shell docker inspect -f {{.State.Running}} "$(NAME)" 2> /dev/null)" == "false" ]]; then \
printf "INFO: Removing existing container '$(NAME)' ..."; \
docker rm "$(NAME)" &> /dev/null && printf " done!\n" || printf " failed!\n"; \
else \
printf "WARN: container '$(NAME)' doesn't exist.\n"; \
fi
run: stop remove
@printf "INFO: Starting new container '$(NAME)' ..."
@docker run --restart=always -d --name="$(NAME)" -v $(shell pwd)/storage/logs:/opt/cloudbot/logs $(AUTHOR)/$(NAME):$(VERSION) &> /dev/null && printf " done!\n" || printf " failed!\n"