-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev
33 lines (31 loc) · 932 Bytes
/
dev
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
#!/usr/bin/python3
# ./dev build
# docker build -t invariant-docs .
# ./dev up
# docker build -t invariant-docs . && docker run -it -p 8000:8000 -e DEV_MODE=true -v .:/docs/ invariant-docs
import sys
import time
import subprocess
import webbrowser
if sys.argv[1] == "build":
print("Building image...")
subprocess.run(["docker", "build", "-t", "invariant-docs", "."])
elif sys.argv[1] == "up":
print("Building image...")
p = subprocess.Popen(
["docker", "build", "-t", "invariant-docs", "."], stdout=subprocess.PIPE
)
p.wait()
print("Starting server...")
p = subprocess.Popen(
"docker run -it -p 8000:8000 -e DEV_MODE=true -v .:/docs/ invariant-docs",
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
time.sleep(1)
webbrowser.open("http://localhost:8000")
p.wait()
else:
print("Usage: ./dev build | ./dev up")
sys.exit(1)