Skip to content

Commit 1dc1d3c

Browse files
committed
feat(script): upgrade base_build to allow build of some bases
1 parent 5f157c9 commit 1dc1d3c

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

script/base_build

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
#!/usr/bin/env python
2+
"""
3+
Build base Docker images contained in the images/ directory.
4+
5+
Usage:
6+
python base_build.py [all|<lang> ...]
7+
8+
default:
9+
build only the foundation image
10+
11+
args:
12+
all - build all base images
13+
<lang> - build only the base image for the specified language
14+
-h, --help - show this help message and exit
15+
"""
216
import subprocess
17+
import sys
318
from pathlib import Path
419

520
IMAGES_DIR = Path("./images")
621
FOUNDATION_IMAGE = (IMAGES_DIR / "Dockerfile.foundation", "whanos-foundation")
722

23+
if "-h" in sys.argv or "--help" in sys.argv:
24+
print(__doc__)
25+
sys.exit(0)
26+
827
subprocess.run(
928
["docker", "build", "-t", FOUNDATION_IMAGE[1], "-"],
1029
input=FOUNDATION_IMAGE[0].read_bytes(),
@@ -15,6 +34,9 @@ for dir_path in IMAGES_DIR.iterdir():
1534
if not dir_path.is_dir():
1635
continue
1736

37+
if not ("all" in sys.argv or dir_path.name in sys.argv):
38+
continue
39+
1840
dockerfile = dir_path / "Dockerfile.base"
1941
if not dockerfile.is_file():
2042
continue

0 commit comments

Comments
 (0)