-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Docker containerization with multi-arch support #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Features: - Complete Docker containerization with s6-overlay init - PUID/PGID support for proper file permissions - Multi-architecture builds (amd64/arm64) - GitHub Actions CI/CD pipeline for ghcr.io publishing - OpenContainer labels for proper metadata Systemd improvements: - Template-based service for multiple subreddits - Per-subreddit config files in /etc/redditmodlog/ - Centralized logging to /var/log/redditmodlog/ - Automatic log rotation (30 days, 100MB max) - Security hardening with read-only filesystem - Resource limits (256MB RAM, 25% CPU) Infrastructure: - Installation script for easy deployment - Logrotate configuration included - Enhanced .gitignore for sensitive files - Updated README with Docker and systemd documentation This provides production-ready deployment options for both Docker and systemd environments.
- Change data directory from /app to /config for consistency - Add startup validation for critical environment variables - Fix GitHub Actions workflow image name to lowercase (GHCR requirement) - Fix health check to use DATABASE_PATH env var - Update all volume mounts to use /config instead of /app - Add proper exit on missing required env vars: - REDDIT_CLIENT_ID - REDDIT_CLIENT_SECRET - REDDIT_USERNAME - REDDIT_PASSWORD - SOURCE_SUBREDDIT - Simplify GitHub Actions tag pattern (remove invalid branch prefix) - Update README documentation for /config paths
Critical fixes from expert review: - Fix multi-arch builds: s6-overlay now selects correct architecture (x86_64 for amd64, aarch64 for arm64, arm for arm/v7) - Fix GitHub Actions SBOM generation image reference - Fix GitHub Actions Trivy security scan image reference - Fix resource limits: use Compose v2 syntax instead of swarm-only deploy - Remove obsolete version directive from docker-compose.yml - Remove unnecessary reverse proxy network comments - Document unsupported env vars (MAX_WIKI_ENTRIES_PER_PAGE, MAX_CONTINUOUS_ERRORS) This resolves blocking issues for arm64 builds and CI/CD pipeline.
Restore .pre-commit-config.yaml that was in original PR but missing from current branch. This file provides code quality, security scanning, and formatting validation hooks.
Add .editorconfig to maintain consistent formatting across editors: - Python: 4 spaces, max line 88 (matches black) - YAML/JSON: 2 spaces - Unix line endings (LF) - UTF-8 encoding - Trim trailing whitespace
- Black reformatted with --line-length=180 - Fixed trailing whitespace and EOF issues - Fixed Dockerfile FROM casing (AS instead of as)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request standardizes code formatting across the entire codebase using Black formatter and adds comprehensive tooling/infrastructure. The changes focus on code style consistency (quotes, whitespace, line breaks) and adding Docker deployment support with CI/CD workflows.
- Code formatting standardized to use double quotes instead of single quotes
- Trailing whitespace removed across all files
- Added Docker support with multi-architecture builds (amd64, arm64)
- Added development tooling (.pre-commit-config.yaml, .editorconfig, .dockerignore)
Reviewed Changes
Copilot reviewed 10 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test_removal_reasons.py | Reformatted with Black: double quotes, proper spacing |
| modlog_wiki_publisher.py | Reformatted with Black: imports reordered, quotes standardized, line 270 exceeds readability |
| docker-compose.yml | New Docker Compose configuration for containerized deployment |
| Dockerfile | New multi-stage Docker build with s6-overlay init system |
| .github/workflows/docker-build.yml | New CI/CD workflow for Docker builds and security scanning |
| .pre-commit-config.yaml | New pre-commit hooks for code quality (Black, flake8, isort, mypy) |
| .editorconfig | New editor configuration for consistent formatting |
| .dockerignore | New Docker ignore patterns for build optimization |
| .gitignore | Enhanced with Docker and environment file patterns |
| systemd/*.service | Trailing newline fixes |
| requirements.txt | Trailing newline fixes |
| renovate.json | Trailing whitespace removal |
| debug_auth.py | Reformatted with Black formatter |
| config_template.json | Trailing newline fix |
| README.md | Enhanced documentation with Docker/systemd deployment sections, trailing whitespace fixes |
| CLAUDE.md | Trailing whitespace removal |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
modlog_wiki_publisher.py
Outdated
| ] | ||
|
|
||
|
|
||
| columns_to_add = [("action_type", "TEXT"), ("moderator", "TEXT"), ("target_id", "TEXT"), ("target_type", "TEXT"), ("display_id", "TEXT"), ("target_permalink", "TEXT")] |
Copilot
AI
Oct 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is 180 characters long which makes it difficult to read and review. Consider splitting this list across multiple lines for better readability, especially since it contains 6 tuples. Example: one tuple per line or grouping 2-3 tuples per line.
| columns_to_add = [("action_type", "TEXT"), ("moderator", "TEXT"), ("target_id", "TEXT"), ("target_type", "TEXT"), ("display_id", "TEXT"), ("target_permalink", "TEXT")] | |
| columns_to_add = [ | |
| ("action_type", "TEXT"), | |
| ("moderator", "TEXT"), | |
| ("target_id", "TEXT"), | |
| ("target_type", "TEXT"), | |
| ("display_id", "TEXT"), | |
| ("target_permalink", "TEXT"), | |
| ] |
modlog_wiki_publisher.py
Outdated
| prefix = prefixes.get(target_type, 'ZZU') | ||
|
|
||
|
|
||
| prefixes = {"post": "P", "comment": "C", "user": "U", "action": "A"} # Use 'A' for action ID when dealing with user actions |
Copilot
AI
Oct 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline comment explains 'Use A for action ID when dealing with user actions' but this is misleading since 'U' is mapped to 'user', not 'A'. The comment should be moved above the line or removed if it's outdated, as it currently suggests a mapping that doesn't match the code.
| prefixes = {"post": "P", "comment": "C", "user": "U", "action": "A"} # Use 'A' for action ID when dealing with user actions | |
| prefixes = {"post": "P", "comment": "C", "user": "U", "action": "A"} |
test_removal_reasons.py
Outdated
| import os | ||
| import sqlite3 | ||
| import sys | ||
| from datetime import datetime, timezone |
Copilot
AI
Oct 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'timezone' is not used.
| from datetime import datetime, timezone | |
| from datetime import datetime |
- Split long tuple list for better readability (line 270) - Fix misleading comment about prefix mapping - Remove unused timezone import from test file - Add .secrets.baseline for detect-secrets - Extend flake8 ignore list for existing code issues
Docker tags cannot contain slashes, so metadata-action converts branch names like 'feature/docker-v2' to 'feature-docker-v2'. Use steps.meta.outputs.version which has the correct format.
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
- Add proper v1.4.0 baseline structure with plugins and filters - Exclude documentation files (README, CLAUDE.md) from secret detection - Exclude systemd scripts with example config placeholders
- Move test files to tests/ directory - Move utility scripts to scripts/ directory - Add data/ to .gitignore explicitly - Update CLAUDE.md to reflect new structure
- Add explicit type annotations for actions_by_target and actions_by_date - Add explicit type annotations for env_config and reddit_config - Fix os.getenv() null-safety issues by storing in variables before use - Update flake8 config to ignore pre-existing code style issues - All mypy and flake8 checks now pass
Summary
Add complete Docker containerization with multi-architecture builds, GitHub Actions CI/CD pipeline, and development tooling.
Docker Features
/config/dataand logs at/config/logsCI/CD Pipeline
Development Tooling
Configuration Changes
/app/datato/config/datafor consistencyREDDIT_CLIENT_IDREDDIT_CLIENT_SECRETREDDIT_USERNAMEREDDIT_PASSWORDSOURCE_SUBREDDITDocumentation
Breaking Changes
None - existing systemd deployments continue to work. Docker is an additional deployment option.
Migration Path
For users currently running with systemd who want to migrate to Docker, a separate migration guide and Hetzner-specific docker-compose files will be provided after merge.
Commit History
Testing