# Makefile

.PHONY: build rebuild pull up down restart ps logs proxy cadvisor exporter

# Variables
COMPOSE=docker compose
ENV_FILE?=.local.env

PROXY_CONTAINER=dockerproxy
CADVISOR_CONTAINER=cadvisor
EXPORTER_CONTAINER=docker_exporter

# Build (usually not required unless you add Dockerfiles)
build:
	$(COMPOSE) build

rebuild:
	$(COMPOSE) build --no-cache

# Pull images
pull:
	$(COMPOSE) pull

# Start containers
up:
	$(COMPOSE) --env-file $(ENV_FILE) up -d

# Stop containers
down:
	$(COMPOSE) --env-file $(ENV_FILE) down

# Restart containers
restart:
	$(COMPOSE) --env-file $(ENV_FILE) restart

# Show status
ps:
	$(COMPOSE) --env-file $(ENV_FILE) ps

# Follow logs
logs:
	$(COMPOSE) --env-file $(ENV_FILE) logs -f --tail=200

# Exec into containers (use sh for maximum compatibility)
proxy:
	docker exec -it $(PROXY_CONTAINER) sh

cadvisor:
	docker exec -it $(CADVISOR_CONTAINER) sh

exporter:
	docker exec -it $(EXPORTER_CONTAINER) sh
