-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
65 lines (56 loc) · 2.01 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.PHONY: mwcfg-server
PWD := $(shell pwd)
USER_ID := $(shell id -u ${USER})
GROUP_ID := $(shell id -g ${USER})
tag=22.04
version=1.1.0
mwcfg-server:
@if [ -z "`docker images -q mwcfg-server:${version} 2> /dev/null`" ]; then \
docker build \
-t mwcfg-server:${version} \
--build-arg tag=${tag} \
-f docker/mwcfg-server.docker .; \
else \
echo "docker build for mwcfg-server:${version} already exists..."; \
fi
mwcfg-server-start:
@if [ -z "`docker ps | grep "mwcfg-server:${version}" | grep -Po '^[a-f0-9]+'`" ]; then \
mkdir -p uploads/; \
docker run \
-d \
--rm \
-v ${PWD}/modules/:/mnt/modules/ \
-v ${PWD}/uploads/:/mnt/uploads/ \
-v ${PWD}/docker/etc/uwsgi/apps-enabled/:/etc/uwsgi/apps-enabled/ \
-v ${PWD}/docker/etc/nginx/conf.d/:/etc/nginx/conf.d/ \
-v ${PWD}/docker/etc/nginx/ssl/:/etc/nginx/ssl/ \
-p 80:80 \
-p 443:443 \
-t mwcfg-server:${version} > /dev/null; \
echo "mwcfg-server:${version} started"; \
else \
echo "mwcfg-server:${version} is already running"; \
fi
mwcfg-server-stop:
@ID=`docker ps | grep "mwcfg-server:${version}" | grep -Po '^[a-f0-9]+'`; \
if [ ! -z "$${ID}" ]; then \
docker stop $${ID} > /dev/null; \
echo "mwcfg-server:${version} stopped"; \
else \
echo "mwcfg-server:${version} is not running"; \
fi
mwcfg-server-restart: mwcfg-server-stop mwcfg-server-start
mwcfg-server-status:
@if [ -z "`docker ps | grep "mwcfg-server:${version}" | grep -Po '^[a-f0-9]+'`" ]; then \
echo "mwcfg-server:${version} is not running"; \
else \
echo "mwcfg-server:${version} is running"; \
fi
mwcfg-server-clean:
@docker rmi --force `docker images | grep mwcfg-server | grep ${version} | tr -s ' ' | cut -d ' ' -f 3`
mwcfg-server-logs:
@docker logs -f `docker ps | grep "mwcfg-server:${version}" | grep -Po '^[a-f0-9]+'`
docker-clean:
@docker stop $(shell docker ps -a -q) 2>/dev/null || echo > /dev/null
@docker rm $(shell docker ps -a -q) 2>/dev/null || echo > /dev/null
@docker rmi $(shell docker images -a -q) 2>/dev/null || echo > /dev/null