forked from camptocamp/c2cgeoportal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-run
executable file
·50 lines (40 loc) · 1.18 KB
/
docker-run
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
#!/usr/bin/python
import sys
import os
import subprocess
import getpass
def main():
args = sys.argv[1:]
docker_cmd = ['docker', 'run']
if args[0][0] == '-':
docker_cmd.append(args[0])
args = args[1:]
# docker_adrs = netifaces.ifaddresses('docker0')[2][0]['addr']
docker_cmd.extend([
"--rm",
"--volume=build:/build",
"--volume={pwd}:/src".format(pwd=os.getcwd()),
"--volume={home}:{home}".format(home=os.environ["HOME"]),
"--volume=/tmp/travis/testgeomapfish:/tmp/travis/testgeomapfish",
"--env=USER_NAME={}".format(getpass.getuser()),
"--env=USER_ID={}".format(os.getuid()),
"--env=GROUP_ID={}".format(os.getgid()),
])
for env in [
"HOME",
"TRAVIS",
"TRAVIS_BRANCH",
"TRAVIS_JOB_ID",
"SRID",
"APACHE_VHOST",
"EXTENT",
]:
docker_cmd.append("--env={}={}".format(env, os.environ.get(env, "")))
docker_cmd.append("camptocamp/geomapfish_build_dev")
docker_cmd.extend(args)
try:
subprocess.check_call(docker_cmd)
except subprocess.CalledProcessError:
exit(2)
if __name__ == "__main__":
main()