feat: add Containerfile and podman-compose setup
Host network mode for direct access to SOCKS5 proxy on localhost. Config volume mounted from ./config. Makefile targets: build, up, down, logs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
Containerfile
Normal file
13
Containerfile
Normal file
@@ -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"]
|
||||||
16
Makefile
16
Makefile
@@ -4,7 +4,7 @@ PIP := $(VENV)/bin/pip
|
|||||||
PYTHON := $(VENV)/bin/python
|
PYTHON := $(VENV)/bin/python
|
||||||
BOUNCER := $(VENV)/bin/bouncer
|
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
|
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}'
|
@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
|
test: ## Run tests
|
||||||
$(VENV)/bin/pytest -v
|
$(VENV)/bin/pytest -v
|
||||||
|
|
||||||
run: ## Run bouncer
|
run: ## Run bouncer locally
|
||||||
$(BOUNCER) --config config/bouncer.toml
|
$(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
|
clean: ## Remove build artifacts
|
||||||
rm -rf $(VENV) dist build *.egg-info src/*.egg-info
|
rm -rf $(VENV) dist build *.egg-info src/*.egg-info
|
||||||
|
|||||||
11
compose.yaml
Normal file
11
compose.yaml
Normal file
@@ -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"]
|
||||||
Reference in New Issue
Block a user