# Makefile — run from the banking-app/ root, alongside docker-compose.yml
#
# Usage:
#   make build     → build both service images (sequentially, avoids Gradle cache lock collisions)
#   make up        → start all containers
#   make down      → stop and remove all containers
#   make restart   → down + build + up in one go
#   make logs      → tail logs from all services
#   make clean     → stop containers AND wipe volumes (fresh DB on next up)
#   make ps        → show running containers

.PHONY: build up down restart logs clean ps

build:
	docker compose build user-account-service
	docker compose build transaction-service

build-fresh:
	docker compose build --no-cache user-account-service
	docker compose build --no-cache transaction-service

up:
	docker compose up

up-d:
	docker compose up -d

down:
	docker compose down

restart: down build up

restart-fresh: down build-fresh up

logs:
	docker compose logs -f

clean:
	docker compose down -v

ps:
	docker compose ps