Merge remote-tracking branch 'origin/master' into 1971-show-image-thumbnails
[arvados.git] / docker / build.sh
1 #! /bin/bash
2
3 build_ok=true
4
5 # Check that:
6 #   * IP forwarding is enabled in the kernel.
7
8 if [ "$(/sbin/sysctl --values net.ipv4.ip_forward)" != "1" ]
9 then
10     echo >&2 "WARNING: IP forwarding must be enabled in the kernel."
11     echo >&2 "Try: sudo sysctl net.ipv4.ip_forward=1"
12     build_ok=false
13 fi
14
15 #   * Docker can be found in the user's path
16 #   * The user is in the docker group
17 #   * cgroup is mounted
18 #   * the docker daemon is running
19
20 if ! docker images > /dev/null 2>&1
21 then
22     echo >&2 "WARNING: docker could not be run."
23     echo >&2 "Please make sure that:"
24     echo >&2 "  * You have permission to read and write /var/run/docker.sock"
25     echo >&2 "  * a 'cgroup' volume is mounted on your machine"
26     echo >&2 "  * the docker daemon is running"
27     build_ok=false
28 fi
29
30 #   * config.yml exists
31 if [ '!' -f config.yml ]
32 then
33     echo >&2 "WARNING: no config.yml found in the current directory"
34     echo >&2 "Copy config.yml.example to config.yml and update it with settings for your site."
35     build_ok=false
36 fi
37
38 # If ok to build, then go ahead and run make
39 if $build_ok
40 then
41     make $*
42 fi