feat: add container support with Containerfile and make targets

- Containerfile: python:3.13-slim base, pip install, copy plugins
- .containerignore: exclude dev artifacts from build context
- Makefile: add build, container-run, container-stop, container-logs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
user
2026-02-15 01:16:05 +01:00
parent 77f9a364e6
commit 7b9cde6192
3 changed files with 42 additions and 1 deletions

13
.containerignore Normal file
View File

@@ -0,0 +1,13 @@
.venv/
.git/
.ruff_cache/
.pytest_cache/
.mypy_cache/
__pycache__/
*.pyc
*.egg-info/
build/
dist/
tests/
docs/
config/derp.toml

13
Containerfile Normal file
View File

@@ -0,0 +1,13 @@
FROM python:3.13-slim
WORKDIR /app
COPY pyproject.toml .
COPY src/ src/
RUN pip install --no-cache-dir .
COPY plugins/ plugins/
COPY config/derp.toml.example config/derp.toml.example
ENTRYPOINT ["derp"]

View File

@@ -1,5 +1,6 @@
.PHONY: install dev test lint clean help
.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
@@ -37,3 +38,17 @@ clean: ## Remove build artifacts
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)
podman run -d --name $(APP_NAME) \
-v ./config/derp.toml:/app/config/derp.toml: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)