forked from jinlmsft/QianJiangYuan
-
Notifications
You must be signed in to change notification settings - Fork 1
/
devenv.py
executable file
·40 lines (37 loc) · 1.14 KB
/
devenv.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
#!/usr/bin/python
import os
import time
import datetime
import argparse
import uuid
import subprocess
import sys
import tempfile
import getpass
import pwd
import grp
from os.path import expanduser
sys.path.append("src/utils")
from DockerUtils import run_docker, build_docker
# prefix and tag will be filled by argument parser.
dirname = "devenv"
if __name__ == '__main__':
parser = argparse.ArgumentParser(description = "Run a docker for development of DL workspace")
parser.add_argument("-p", "--prefix",
help="Prefix of the docker name, or [dev]",
action="store",
default="dev" )
parser.add_argument("-t", "--tag",
help="Tag of the docker build, or [current]",
action = "store",
default = "latest" )
parser.add_argument("--nocache",
help="Tag of the docker build, or [current]",
action = "store_true")
args = parser.parse_args()
dockerprefix = args.prefix
dockertag = args.tag
dockername = dockerprefix + ":" + dockertag
#print args.nocache
dockername = build_docker(dockername, dirname, nocache = args.nocache)
run_docker(dockername, "DevDocker")