rentease/Makefile
Ruidy 584d81f7bd
Some checks failed
CI / checks (push) Has been cancelled
feat(i18n): add language toggle and localize views
2026-01-09 16:09:20 -04:00

39 lines
1.2 KiB
Makefile

# Defaults (override via `make VAR=value`)
NAME ?= rentease
PORT ?= 8000
DB_USER ?= ruidy
DB_NAME ?= villafleurie
DEV_COMPOSE ?= docker-compose.dev.yml
DOCKER_RUN_ENV = -e DATABASE_URL="host=docker.for.mac.host.internal user=$(DB_USER) database=$(DB_NAME)" -e PORT=$(PORT)
.PHONY: help build run dev test up-deps format lint stop
help: ## List available commands
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " %-12s %s\n", $$1, $$2}'
build: format lint ## Build the production Docker image
docker build -t $(NAME):latest .
run: build ## Run the production container (port $(PORT))
docker run -p $(PORT):$(PORT) $(DOCKER_RUN_ENV) $(NAME)
dev: ## Start the local dev stack via docker compose
docker compose -f $(DEV_COMPOSE) up --build
test: ## Run Go tests inside the running dev container
go test ./...
up-deps: ## Update Go dependencies on host
go get -u ./...
format: ## Generate templ files and format code locally
templ generate -path internal/view
templ fmt .
go fmt ./...
lint: ## Lint the code using golangci-lint locally
golangci-lint run ./...
stop: ## Stop the dev stack
-@docker compose -f $(DEV_COMPOSE) down --remove-orphans >/dev/null 2>&1 || true