Merge pull request #652 from Routstr/fix/reduce-docker-build-context

fix(docker): exclude runtime state from build context
This commit is contained in:
9qeklajc
2026-08-08 00:38:13 +02:00
committed by GitHub
2 changed files with 94 additions and 6 deletions
+46 -6
View File
@@ -1,13 +1,53 @@
.env
.venv
# Git and repository metadata
.git
.gitignore
.dockerignore
compose.yml
compose.testing.yml
.todo
.github
.vscode
.DS_Store
**/node_modules
.todo
# Local configuration and secrets
**/.env
**/.env.*
**/routstr_secret.key
# Python environments, caches, and build artifacts
**/.venv
**/__pycache__
**/*.py[cod]
**/.pytest_cache
**/.mypy_cache
**/.ruff_cache
**/.coverage
**/htmlcov
**/*.egg-info
**/build
**/dist
# Runtime state must never be baked into the image
logs
logs.*
**/*.log
**/.wallet*
**/.cashu
**/*.db
**/*.db-*
**/*.sqlite3
**/*.sqlite3-*
**/keys
**/proof_backups
**/relay-data
# The UI output is built by its own service and mounted at runtime
ui_out
ui/.next
ui/out
**/node_modules
# Compose and local development files
compose.yml
compose.testing.yml
compose.override.yml
plans
.worktrees
+48
View File
@@ -0,0 +1,48 @@
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
def test_backend_docker_context_excludes_generated_and_runtime_state() -> None:
patterns = {
line.strip()
for line in (REPO_ROOT / ".dockerignore").read_text().splitlines()
if line.strip() and not line.lstrip().startswith("#")
}
required_patterns = {
"**/.env",
"**/.env.*",
"**/routstr_secret.key",
"**/.venv",
"**/__pycache__",
"**/*.py[cod]",
"**/.pytest_cache",
"**/.mypy_cache",
"**/.ruff_cache",
"**/.coverage",
"**/htmlcov",
"**/*.egg-info",
"**/build",
"**/dist",
"logs",
"logs.*",
"**/*.log",
"**/.wallet*",
"**/.cashu",
"**/*.db",
"**/*.db-*",
"**/*.sqlite3",
"**/*.sqlite3-*",
"**/keys",
"**/proof_backups",
"**/relay-data",
"ui_out",
"ui/.next",
"ui/out",
}
assert required_patterns <= patterns, (
"The backend Docker context must exclude local build artifacts and "
f"runtime state; missing patterns: {sorted(required_patterns - patterns)}"
)