mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-28 22:06:31 +00:00
Introduce a modular mirror subsystem with: - canonical ImageRef model - shared discovery & normalization logic for Docker Hub images - pluggable registry providers (GHCR, Gitea-ready) - inventory resolver for mirrored image paths - skopeo-based mirror sync implementation Design follows SRP/KISS principles and allows future registry backends. https://chatgpt.com/share/6971e6cf-be18-800f-9419-589fd3e22c3d
27 lines
690 B
Python
27 lines
690 B
Python
from __future__ import annotations
|
|
import argparse
|
|
from pathlib import Path
|
|
|
|
from cli.mirror.util import iter_role_images
|
|
from cli.mirror.providers import GHCRProvider
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--repo-root", default=".")
|
|
parser.add_argument("--ghcr-namespace", required=True)
|
|
parser.add_argument("--ghcr-prefix", default="mirror")
|
|
args = parser.parse_args()
|
|
|
|
provider = GHCRProvider(args.ghcr_namespace, args.ghcr_prefix)
|
|
repo_root = Path(args.repo_root).resolve()
|
|
|
|
for img in iter_role_images(repo_root):
|
|
provider.mirror(img)
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|