EXEC=products-app
CONTAINER_NAME=products-app
IMAGE_NAME=komponiranje-products-app


run:
	@air


.PHONY: build
build:
	@go build -ldflags "-s -w" -o ./build/${EXEC} ./app/.


upgrade-packages:
	@go get -u ./...


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


docker-run:
	@docker run \
		--name $(CONTAINER_NAME) \
		--publish 3000:3000 \
		--env CONTAINER_NAME="Awesome API server" \
		--env DBPORT=55432 \
		--detach \
		$(IMAGE_NAME)


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