IMAGE_NAME=komponiranje-pg
CONTAINER_NAME=komponiranje-database


build: clean
	@docker build \
		--progress=plain \
		--tag $(IMAGE_NAME) \
		.


run:
	@docker run \
		--name $(CONTAINER_NAME) \
		--env POSTGRES_USER=postgres \
		--env POSTGRES_PASSWORD=postgres \
		--publish 55432:5432 \
		--detach \
		$(IMAGE_NAME)


rm:
	- @docker stop $(CONTAINER_NAME)
	- @docker rm $(CONTAINER_NAME)


drop:
	- @docker stop $(CONTAINER_NAME)
	- @docker rm $(CONTAINER_NAME) -v


clean:
	- @docker stop $(CONTAINER_NAME)
	- @docker rm $(CONTAINER_NAME)
	- @docker rmi $(IMAGE_NAME)
