# ────────────────────────────────────────────────────
# Build helpers for the two-image CI/CD setup.
#
# Deps (WhisperX, PyTorch, etc.) live in a separate
# base image that seldom changes.  CI builds deps
# only when requirements.txt changes, then builds
# the thin app image on every push — no pip install
# during the common case, so pulls are tiny.
#
# Local dev — same flow:
#   make deps    # one-time, 5-10 min
#   make build   # fast, every time
# ────────────────────────────────────────────────────

DOCKER    := docker
COMPOSE   := docker compose
DEPS_IMG  := nat20-whisperx-base
DEPS_FILE := Dockerfile.deps

.PHONY: deps build run clean

## deps       — Build the heavy deps layer (only when requirements.txt changes)
deps:
	$(DOCKER) build -f $(DEPS_FILE) -t $(DEPS_IMG) .

## build      — Build the app image (fast — no pip)
build:
	$(DOCKER) build -t nat20-notes-backend .

## run        — Start everything with docker compose
run:
	$(COMPOSE) up -d --build

## clean      — Remove dangling images
clean:
	$(DOCKER) image prune -f
