From 436a81e2a8ab8fc5388badda0d207d21ddb3e0b0 Mon Sep 17 00:00:00 2001 From: Robert Rapp Date: Mon, 15 Sep 2025 19:38:57 +0200 Subject: [PATCH] chore: add Makefile for proxy/app lifecycle commands --- Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b846a82 --- /dev/null +++ b/Makefile @@ -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}}' +