oorabona/docker-containers

GitHub: oorabona/docker-containers

一套具备自动上游监控和智能重建机制的生产级Docker镜像构建框架,涵盖数据库、CI/CD运行器、安全工具等多种基础设施工具的容器化镜像。

Stars: 4 | Forks: 2

# Docker 容器 生产就绪的 Docker 镜像,具备**零干预上游监控**功能——当新版本发布时,会自动进行构建。 [![自动构建](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/dcecefa782142013.svg)](https://github.com/oorabona/docker-containers/actions/workflows/auto-build.yaml) [![上游监控](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/81af02aee4142014.svg)](https://github.com/oorabona/docker-containers/actions/workflows/upstream-monitor.yaml) [![ShellCheck](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/551da489a9142015.svg)](https://github.com/oorabona/docker-containers/actions/workflows/shellcheck.yaml) ## 包含内容 | 容器 | 功能说明 | 变体 | |-----------|-------------|----------| | [postgres](postgres/) | 具备扩展生态系统的 PostgreSQL | base、vector、analytics、timeseries、spatial、distributed、full | | [terraform](terraform/) | Terraform CLI,限定云服务商范围 | base、aws、azure、gcp、full | | [github-runner](github-runner/) | 自托管 GitHub Actions 运行器 | ubuntu-2404、debian-trixie、windows-ltsc2022 × base/dev | | [web-shell](web-shell/) | 通过 HTTPS 在浏览器访问的 shell | debian (默认)、alpine、ubuntu、rocky | | [wordpress](wordpress/) | 带有 PHP 优化的 WordPress | — | | [openresty](openresty/) | Nginx + Lua Web 平台 | — | | [php](php/) | PHP-FPM 运行时 | — | | [ansible](ansible/) | 自动化平台 | — | | [vector](vector/) | Datadog Vector 日志/指标发送器 | — | | [debian](debian/) | 最小化基础镜像 | — | | [jekyll](jekyll/) | 静态站点生成器 | — | | [openvpn](openvpn/) | VPN 服务器 | — | | [sslh](sslh/) | SSL/SSH 端口多路复用器 | — | 所有镜像均发布至 [GHCR](https://github.com/oorabona?tab=packages) 和 [Docker Hub](https://hub.docker.com/u/oorabona)。 ## 工作原理 ``` Upstream releases new version │ ▼ upstream-monitor.yaml ← daily at 06:00 UTC detects version change │ ▼ Creates PR + triggers auto-build.yaml │ ▼ Smart rebuild: compares ← skips if nothing changed build digest vs registry │ ▼ Multi-arch build ← linux/amd64 + linux/arm64 (native runners, no QEMU) │ ▼ Push to GHCR + Docker Hub Emit build lineage JSON │ ▼ Auto-merge PR ``` **核心差异化优势:** - **智能重建检测** — 基于内容的摘要会跳过未更改的构建 ([ADR-002](docs/adr/ADR-002-smart-rebuild-detection.md)) - **声明式变体** — 一个 Dockerfile,通过 `variants.yaml` 衍生出 N 种风格 ([ADR-003](docs/adr/ADR-003-variant-system.md)) - **构建血统追踪** — 从源代码到已发布镜像的完整来源链 ([ADR-004](docs/adr/ADR-004-build-lineage-tracking.md)) - **原生多架构与多操作系统** — 在专用运行器上并行执行 `linux/amd64` + `linux/arm64` 构建(无需模拟),并且 github-runner 镜像支持 `windows-ltsc2022` ([ADR-001](docs/adr/ADR-001-multi-platform-native-runners.md)) - **单源多发行版** — github-runner 和 web-shell 在构建时将单个模板扩展为各发行版专用的 Dockerfile ([ADR-006](docs/adr/ADR-006-multi-distro-template-pattern.md)) - **供应链透明度** — 每个已发布的镜像都附带经 Sigstore 认证的 SBOM、Trivy CRITICAL 级别扫描历史记录,以及多架构 manifest 引用。仪表盘将它们展示为可点击的信任徽章;`/verify-images/` 页面记录了如何在本地复现每项检查。 ## 快速入门 ``` # 列出容器 ./make list # 构建容器(自动发现最新 upstream 版本) ./make build postgres # 使用特定版本构建 ./make build postgres 17 # 推送到 registries ./make push postgres # 检查 upstream 内容 ./make version postgres # 检查所有容器的更新 ./make check-updates # 显示构建 lineage ./make lineage postgres # 显示 image 大小 ./make sizes ``` ## 添加容器 1. 创建一个包含 `Dockerfile` 和 `version.sh` 的目录: ``` mkdir my-app ``` 2. `version.sh` 用于发现最新的上游版本: ``` #!/bin/bash source "$(dirname "$0")/../helpers/docker-registry" get_latest_upstream() { latest-docker-tag library/nginx "^[0-9]+\.[0-9]+\.[0-9]+$" } handle_version_request "$1" "oorabona/my-app" "^[0-9]+\.[0-9]+\.[0-9]+$" "get_latest_upstream" ``` 3. 构建并测试: ``` ./make build my-app ./make run my-app ``` 完成。CI 会在下次推送时自动接管。 ## 要求 - Docker Engine 20.10+(或 Podman) - Bash 4.0+ - [yq](https://github.com/mikefarah/yq)(用于变体容器) ## 文档 - [开发指南](docs/DEVELOPMENT.md) — 内部结构、变体、构建系统 - [CI/CD 工作流](docs/GITHUB_ACTIONS.md) — GitHub Actions 参考 - [架构](docs/WORKFLOW_ARCHITECTURE.md) — 流水线设计 - [本地开发](docs/LOCAL_DEVELOPMENT.md) — 开发环境设置 - [测试指南](docs/TESTING_GUIDE.md) — 在本地运行测试 - [容器仪表盘](https://oorabona.github.io/docker-containers/) — 包含信任徽章的实时构建状态 - [验证镜像](https://oorabona.github.io/docker-containers/verify-images/) — 在本地复现 SBOM / Trivy / 多架构检查 ## 许可证 [MIT](LICENSE)
标签:Ansible, CI/CD流水线, Debian, Docker, ECS, GitHub Actions, GitHub Actions Runner, HTTPS, Jekyll, OpenResty, OpenVPN, PHP-FPM, PostgreSQL, ShellCheck, SSLH, Terraform, Vector, VPN, Web Shell, WordPress, 上游监控, 云服务, 多路复用, 安全Shell, 安全防御评估, 容器, 容器化部署, 应用安全, 开发环境, 开源框架, 持续部署, 持续集成, 数据库, 日志收集, 生产就绪, 网络工具, 自动化构建, 自动化运维, 自动笔记, 自托管运行器, 请求拦截, 静态网站生成