diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..25ae12c --- /dev/null +++ b/Containerfile @@ -0,0 +1,13 @@ +FROM python:3.12-slim + +WORKDIR /app + +COPY pyproject.toml . +COPY src/ src/ + +RUN pip install --no-cache-dir . + +VOLUME /data + +ENTRYPOINT ["bouncer"] +CMD ["-c", "/data/bouncer.toml"] diff --git a/Makefile b/Makefile index 7b09221..9af6065 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PIP := $(VENV)/bin/pip PYTHON := $(VENV)/bin/python BOUNCER := $(VENV)/bin/bouncer -.PHONY: help venv install dev lint fmt test run clean +.PHONY: help venv install dev lint fmt test run clean build up down logs 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}' @@ -29,8 +29,20 @@ fmt: ## Format code test: ## Run tests $(VENV)/bin/pytest -v -run: ## Run bouncer +run: ## Run bouncer locally $(BOUNCER) --config config/bouncer.toml +build: ## Build container image + podman build -t $(APP_NAME) -f Containerfile . + +up: ## Start container (podman-compose) + podman-compose up -d + +down: ## Stop container + podman-compose down + +logs: ## Tail container logs + podman logs -f $(APP_NAME) + clean: ## Remove build artifacts rm -rf $(VENV) dist build *.egg-info src/*.egg-info diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..224b432 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,11 @@ +services: + bouncer: + build: + context: . + dockerfile: Containerfile + container_name: bouncer + restart: unless-stopped + network_mode: host + volumes: + - ./config:/data:Z + command: ["-c", "/data/bouncer.toml", "-v"]