41 lines
840 B
Makefile
41 lines
840 B
Makefile
# === Configuration ===
|
|
# Default value is 'dev'. Can be overridden with 'make ENV=prod ...'
|
|
ENV ?= dev
|
|
COMPOSE_FILE = docker-compose$(if $(filter $(ENV),prod),.prod,).yml
|
|
COMPOSE = docker compose -f $(COMPOSE_FILE)
|
|
# Service name of the dev container
|
|
SERVICE_NAME = app
|
|
|
|
.PHONY: up stop build deploy logs
|
|
|
|
# Standard Start (on iMac: 'make run' -> dev | on Pi: 'make ENV=prod run')
|
|
run: stop up
|
|
|
|
up:
|
|
$(COMPOSE) up -d
|
|
|
|
# Build command
|
|
build:
|
|
$(COMPOSE) build
|
|
|
|
# The Deployment Routine for your Pi
|
|
# You would call this with: make ENV=prod deploy
|
|
deploy: stop pull build up clean
|
|
|
|
pull:
|
|
git pull origin main
|
|
|
|
stop:
|
|
$(COMPOSE) down --remove-orphans
|
|
|
|
logs:
|
|
$(COMPOSE) logs -f
|
|
|
|
clean:
|
|
docker image prune -f
|
|
|
|
ui:
|
|
$(COMPOSE) exec $(SERVICE_NAME) npx shadcn@latest add $(component)
|
|
|
|
i:
|
|
$(COMPOSE) exec $(SERVICE_NAME) npm install $(package)
|