forked from ucphhpc/nbi-jupyter-docker-stacks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.py
executable file
·47 lines (41 loc) · 1.27 KB
/
configure.py
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
import os
import argparse
parser = argparse.ArgumentParser(
description="Configuration script for " "Dockerfile build tags"
)
parser.add_argument("-t", "--tag", action="store", default="edge")
parser.add_argument("-i", "--image", action="store", default="python-noteboook")
args = parser.parse_args()
IMAGES = [
"python-notebook",
"r-notebook",
"slurm-notebook",
"python-cuda-notebook",
"gpu-notebook",
"dgx1-notebook",
"datascience-notebook",
"chemistry-notebook",
"fenics-notebook",
"qsharp-notebook",
"statistics-notebook",
"tomography-notebook",
"hpc-notebook",
"hpc-ocean-notebook",
"ocean-notebook",
"geo-notebook",
"bio-notebook",
"sme-notebook",
]
if __name__ == "__main__":
# Replace all FROM tags
for i in IMAGES:
path_docker = os.path.join(os.getcwd(), i, "Dockerfile")
with open(path_docker, "r") as f_docker:
from_line = f_docker.readline()
content = f_docker.readlines()
if from_line and content:
image_tag = from_line.split(":")
new_from = "".join([image_tag[0], ":", args.tag, "\n"])
with open(path_docker, "w") as f_docker:
f_docker.write(new_from)
f_docker.writelines(content)