To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / SCRIPTS / dockerbuild.sh

History | View | Annotate | Download (1.11 KB)

1
#!/bin/bash
2
#
3
# Docker required!
4

    
5
if [ -z "$1" ] || [ -z "$2" ]; then
6
    echo "Usage: $0 <repo> <repo-revision-id>"
7
    exit 2
8
fi
9

    
10
platform=ubuntu1604
11
dockerfile=SCRIPTS/Dockerfile_$platform
12

    
13
mkdir -p "PACKAGES/$platform"
14

    
15
if [ ! -f "$dockerfile.in" ]; then
16
    echo "Docker file source $dockerfile.in not found (are we in the right directory?"
17
    exit 1
18
fi
19

    
20
set -eu
21

    
22
repo="$1"
23
repo_revision="$2"
24

    
25
current=$(hg id | awk '{ print $1; }')
26

    
27
case "$current" in
28
    *+) echo "WARNING: Current working copy has been modified - build will check out the last commit, which must perforce be different";;
29
    *);;
30
esac
31

    
32
current=${current%%+}
33

    
34
cat "$dockerfile.in" \
35
    | perl -p -e 's/\[\[REVISION\]\]/'"$current"'/' \
36
    | perl -p -e 's/\[\[REPO\]\]/'"$repo"'/' \
37
    | perl -p -e 's/\[\[REPOREVISION\]\]/'"$repo_revision"'/' \
38
           > "$dockerfile"
39

    
40
dockertag="cannam/vamp-build-and-test-$current"
41

    
42
sudo docker build -t "$dockertag" -f "$dockerfile" SCRIPTS
43

    
44
container=$(sudo docker create "$dockertag")
45
sudo docker cp "$container":vamp-build-and-test/PACKAGES/linux64/ "PACKAGES/$platform"/
46
sudo docker rm "$container"
47

    
48
echo "Done!"
49