diff --git a/.containerignore b/.containerignore new file mode 100644 index 0000000..7c8c564 --- /dev/null +++ b/.containerignore @@ -0,0 +1,13 @@ +.venv/ +.git/ +.ruff_cache/ +.pytest_cache/ +.mypy_cache/ +__pycache__/ +*.pyc +*.egg-info/ +build/ +dist/ +tests/ +docs/ +config/derp.toml diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..87a99de --- /dev/null +++ b/Containerfile @@ -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"] diff --git a/Makefile b/Makefile index 666a98d..5ca51a4 100644 --- a/Makefile +++ b/Makefile @@ -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)