ENV ?= dev export ENVIRONMENT = $(ENV) # DB_PASSWORD/DB_ROOT_PASSWORD are stripped from what Compose loads — they # only flow through secrets/ now, and Compose warns "variable not set" on # any $-shaped value in --env-file even when nothing consumes it. Rewritten # fresh on every `make` invocation, so it can't drift from .env.$(ENV). COMPOSE_ENV_FILE := .env.$(ENV).compose $(shell grep -Ev '^(DB_PASSWORD|DB_ROOT_PASSWORD)=' .env.$(ENV) > $(COMPOSE_ENV_FILE) 2>/dev/null) COMPOSE = docker compose -p bookstore-$(ENV) -f docker-compose.yml -f docker-compose.$(ENV).yml --env-file $(COMPOSE_ENV_FILE) .PHONY: up down ps logs shell wp deploy backup up: $(COMPOSE) up -d --build down: $(COMPOSE) down ps: $(COMPOSE) ps logs: $(COMPOSE) logs -f shell: $(COMPOSE) exec wordpress bash # make wp ENV=staging ARGS="plugin list" wp: $(COMPOSE) exec wordpress wp $(ARGS) --allow-root deploy: ./deploy/deploy.sh $(ENV) backup: ./deploy/backup.sh $(ENV)