Skip to content
Makefile 1.4 KiB
Newer Older
CONTAINER_VERSION := 0.7.2
CONTAINER_REGISTRY := e5.lan:5000
CONTAINER_NAME := greppy.org
CONTAINER_URI := $(CONTAINER_REGISTRY)/$(CONTAINER_NAME):$(CONTAINER_VERSION)
QUICKSTART_CONTAINER := greppy-quickstart

.PHONY: all help build start start-bash stop clean rebuild logs

all: help
help:
	##### Development #####
	# build            Build the docker container
	# rebuild          Full test cycle, clean, build, start and show logs
	# clean            Remove the builded image
	#
	##### Process control #####
	# start            Start the builded container
	# start-bash       Start a bash shell on the builded container
	# stop             Stop and remove the builded container
	# logs             Show the logs of the container

build:
	time docker build -t "$(CONTAINER_URI)" .

start:
	docker run --name='$(QUICKSTART_CONTAINER)' -d \
		-p 10080:80 -e 'MONGODB_HOST=10.0.0.140' \
		"$(CONTAINER_URI)"

start-bash:
	docker run -i --name='$(QUICKSTART_CONTAINER)-bash' \
		-p 10080:80 -e 'MONGODB_HOST=10.0.0.140' \
		"$(CONTAINER_URI)" /bin/bash

stop:
	docker stop '$(QUICKSTART_CONTAINER)' || exit 0
	docker stop '$(QUICKSTART_CONTAINER)-bash' || exit 0
	docker rm '$(QUICKSTART_CONTAINER)' || exit 0
	docker rm '$(QUICKSTART_CONTAINER)-bash' || exit 0

clean: stop
	docker rmi "$(CONTAINER_URI)" || exit 0

rebuild: clean build start logs

logs:
	docker logs -f '$(QUICKSTART_CONTAINER)'