This repository was archived by the owner on Apr 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_images.py
More file actions
executable file
·82 lines (73 loc) · 2.51 KB
/
build_images.py
File metadata and controls
executable file
·82 lines (73 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env -S uv run
# /// script
# requires-python = "==3.13"
# dependencies = [
# "dockeree",
# ]
# ///
"""Python script for building Docker images via GitHub Actions."""
from argparse import ArgumentParser, Namespace
from dockeree import DockerImageBuilder
REPOS = {
"https://github.com/legendu-net/docker-rust-utils": "",
"https://github.com/legendu-net/docker-rust-cicd": "",
"https://github.com/legendu-net/docker-python-portable": "",
"https://github.com/legendu-net/docker-vscode-server": "",
# "https://github.com/legendu-net/docker-gitpod": "",
"https://github.com/legendu-net/docker-jupyterhub-ds": "",
"https://github.com/legendu-net/docker-jupyterhub-pytorch": "",
"https://github.com/legendu-net/docker-tensorboard": "",
"https://github.com/legendu-net/docker-jupyterhub-kotlin": "",
"https://github.com/legendu-net/docker-jupyterhub-ganymede": "",
# "https://github.com/legendu-net/docker-jupyterhub-sagemath": "",
"https://github.com/legendu-net/docker-rustpython": "",
}
BRANCH_URLS = {
"main": REPOS,
"dev": REPOS,
# "26.04": REPOS,
"rust_nightly": {
# "https://github.com/legendu-net/docker-rust-utils": "",
},
}
def parse_args(args=None, namespace=None) -> Namespace:
"""Parse command-line arguments."""
parser = ArgumentParser(description="Build Docker images.")
parser.add_argument(
"--branch",
dest="branch",
required=True,
help="The GitHub branch of repositories to build.",
)
parser.add_argument(
"--repo",
dest="repo",
required=True,
help="The leaf repository to build",
)
parser.add_argument(
"--root-image-name",
dest="root_image_name",
required=True,
help="The name of the base/root Docker image in dependency resolving.",
)
parser.add_argument(
"--remove-images",
dest="remove_images",
action="store_true",
help="Remove a Docker image when it's not needed (for building other images).",
)
return parser.parse_args(args=args, namespace=namespace)
def main() -> None:
"""The main function of the script."""
args = parse_args()
branch_urls = BRANCH_URLS
if args.repo:
if not args.branch:
args.branch = "dev"
branch_urls = {args.branch: {args.repo: args.root_image_name}}
builder = DockerImageBuilder(branch_urls)
builder.build_images(remove=args.remove_images)
builder.save_graph()
if __name__ == "__main__":
main()