Bind-mount src/ and data/ alongside plugins/ and config so the container picks up code changes without rebuilding. Update Makefile targets, compose file, and INSTALL.md to match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
70 lines
1.8 KiB
Makefile
70 lines
1.8 KiB
Makefile
.PHONY: install dev test lint clean help build container-run container-stop container-logs update-data up down 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 code + config + data)
|
|
podman run -d --name $(APP_NAME) \
|
|
-v ./src:/app/src:ro,Z \
|
|
-v ./plugins:/app/plugins:ro,Z \
|
|
-v ./config/derp.toml:/app/config/derp.toml:ro,Z \
|
|
-v ./data:/app/data: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)
|
|
|
|
update-data: ## Download/refresh local data files
|
|
./scripts/update-data.sh
|
|
|
|
up: ## Start with podman-compose (detach)
|
|
podman-compose up -d
|
|
|
|
down: ## Stop with podman-compose
|
|
podman-compose down
|
|
|
|
logs: ## Follow compose logs
|
|
podman-compose logs -f
|