Files
derp/Makefile
user 830add0797 refactor: mount plugins and config instead of baking into image
Image now contains only the derp package. Config and plugins are
bind-mounted at runtime, enabling live edits without rebuilds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:20:30 +01:00

56 lines
1.5 KiB
Makefile

.PHONY: install dev test lint clean help build container-run container-stop container-logs
APP_NAME := derp
VENV := .venv
PIP := $(VENV)/bin/pip
PYTHON := $(VENV)/bin/python
PYTEST := $(VENV)/bin/pytest
RUFF := $(VENV)/bin/ruff
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[38;5;110m%-12s\033[0m %s\n", $$1, $$2}'
venv: ## Create virtual environment
python3 -m venv $(VENV)
$(PIP) install --upgrade pip
install: venv ## Install package (editable)
$(PIP) install -e .
$(PIP) install pytest ruff
test: ## Run tests
$(PYTEST) -v
lint: ## Run linter
$(RUFF) check src/ tests/ plugins/
fmt: ## Format code
$(RUFF) format src/ tests/ plugins/
run: ## Run the bot
$(PYTHON) -m derp
clean: ## Remove build artifacts
rm -rf build/ dist/ *.egg-info src/*.egg-info
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
link: install ## Symlink to ~/.local/bin
ln -sf $$(pwd)/$(VENV)/bin/derp ~/.local/bin/derp
@echo "Installed: $$(which derp)"
build: ## Build container image
podman build -t $(APP_NAME) .
container-run: ## Run bot in container (mount config + plugins)
podman run -d --name $(APP_NAME) \
-v ./config/derp.toml:/app/config/derp.toml:ro,Z \
-v ./plugins:/app/plugins:ro,Z \
$(APP_NAME)
container-stop: ## Stop and remove container
podman stop $(APP_NAME) && podman rm $(APP_NAME)
container-logs: ## Follow container logs
podman logs -f $(APP_NAME)