summaryrefslogtreecommitdiffstats
path: root/adei/Makefile
blob: 1a88f6fd961d567940b46a68a53c0dad4c4e6e8f (plain)
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
all: build build-mini
mini: build-mini
install: push push-mini
install-mini: push-mini

.PHONY: rebuild build push start stop restart bash mini install-mini deps-mini build-mini rebuild-mini push-mini bash-mini

deps-mini: 
	docker pull chsa/microadei:latest

build-mini: deps-mini Dockerfile.mini
	docker build -f Dockerfile.mini --tag chsa/adei-minimal:latest .
#	docker build -f Dockerfile.mini --tag chsa/adei-minimal-squashed:latest --squash .

rebuild-mini: deps-mini Dockerfile.mini
	docker build -f Dockerfile.mini --tag chsa/adei-minimal:lates --no-cache .

push-mini: build-mini
	docker push chsa/adei-minimal:latest

bash-mini: build-mini
	docker exec -it adei-minimal /bin/bash

build: Dockerfile
	docker build --tag chsa/adei:latest .

rebuild: Dockerfile
	docker build --no-cache --tag chsa/adei:latest .

push: build
	docker push chsa/adei:latest

start: build
	@if [ `docker ps | grep adei-mysql | wc -l` -eq 0 ]; then \
	    if [ `docker ps -a | grep adei-mysql | wc -l` -eq 0 ]; then \
		docker run --name adei-mysql -p 53306:3306/tcp  -e MYSQL_ROOT_PASSWORD="adei" -e MYSQL_DATABASE="adei" -e MYSQL_USER="adei" -e MYSQL_PASSWORD="adei" -d mysql:5.7 ;\
	    else \
		docker start adei-mysql ;\
	    fi ;\
	fi ;\
	if [ `docker ps | grep chsa/adei | wc -l` -eq 0 ]; then \
	    if [ `docker ps -a | grep adei-full | wc -l` -gt 0 ]; then \
		echo "Removing the stalled copy..." ;\
		docker rm adei-full ;\
	    fi ;\
	    docker run -p 8000:80 --name adei-full --link adei-mysql:adei-mysql -e ADEI_PORTS=8000 -t -d chsa/adei:latest ;\
	else \
	    echo "Already running..." ;\
	fi

stop:
	@if [ `docker ps | grep adei-full | wc -l` -gt 0 ]; then \
	    docker stop adei-full ;\
	    docker rm adei-full ;\
	fi

stop_mysql: stop
	docker stop adei-mysql

restart:
	make stop
	make start

bash: build
	docker exec -it adei-full /bin/bash