chore: add Makefile for proxy/app lifecycle commands

This commit is contained in:
2025-09-15 19:38:57 +02:00
parent fa6780d032
commit 436a81e2a8

42
Makefile Normal file
View File

@@ -0,0 +1,42 @@
SHELL := /bin/bash
# Environment selection
ENV ?= development
COMMON_ENV := infra/env/$(ENV)/common.env
# Helper to pass env files if present
define with_env
$(foreach f,$(1),$(if $(wildcard $(f)),--env-file $(f),))
endef
.PHONY: bootstrap proxy-up proxy-down proxy-logs app-up app-down app-logs ps
bootstrap:
@bash scripts/infra/bootstrap.sh
proxy-up:
@docker compose -f infra/core/traefik/docker-compose.yml $(call with_env,$(COMMON_ENV) infra/apps/traefik/.env) up -d
proxy-down:
@docker compose -f infra/core/traefik/docker-compose.yml $(call with_env,$(COMMON_ENV) infra/apps/traefik/.env) down
proxy-logs:
@docker compose -f infra/core/traefik/docker-compose.yml $(call with_env,$(COMMON_ENV) infra/apps/traefik/.env) logs -f
# Usage: make app-up APP=nextcloud
APP ?=
app-up:
@test -n "$(APP)" || (echo "APP not set. Example: make app-up APP=nextcloud" && exit 1)
@docker compose -f infra/apps/$(APP)/docker-compose.yml $(call with_env,$(COMMON_ENV) infra/apps/$(APP)/.env) up -d
app-down:
@test -n "$(APP)" || (echo "APP not set. Example: make app-down APP=nextcloud" && exit 1)
@docker compose -f infra/apps/$(APP)/docker-compose.yml $(call with_env,$(COMMON_ENV) infra/apps/$(APP)/.env) down
app-logs:
@test -n "$(APP)" || (echo "APP not set. Example: make app-logs APP=nextcloud" && exit 1)
@docker compose -f infra/apps/$(APP)/docker-compose.yml $(call with_env,$(COMMON_ENV) infra/apps/$(APP)/.env) logs -f
ps:
@docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Networks}}'