.DEFAULT_GOAL := start

start: 
	@docker-compose up -d

clean:
	@docker-compose kill
	@docker-compose rm --force

build:
	@docker-compose build

build_with_force:
	@docker-compose build --force-rm --no-cache

up:
	@docker-compose up -d

rebuild: clean build up

rebuild_all: clean build_with_force up

error:
	@tail -f build/logs/error_log

access:
	@tail -f build/logs/access_log

# Drop into a bash shell in the running Webpack devserver container
cli:
	@docker exec -it frontendaccounting_accounting_1 bash

accounting:
	@open -a "Google Chrome" http://accounting.192.168.99.100.xip.io

# Delete all untagged images; cleans up disk space in docker-machine VM: http://blog.benhall.me.uk/2015/01/boot2docker-runs-disk-space/
# This is safe! It won't delete your latest built docker container because it will be tagged "latest", not "<none>"
space:
	@docker rmi `docker images | grep '<none>' | tr -s ' ' | cut -d ' ' -f 3`

.PHONY: build start clean rebuild error access cli accounting space
