comparison build/docker/build.sh @ 491:124752918a1b vamp-plugin-sdk-v2.7

Add Docker build scripts
author Chris Cannam
date Fri, 24 Feb 2017 15:45:50 +0000
parents
children
comparison
equal deleted inserted replaced
490:703da7b180e8 491:124752918a1b
1 #!/bin/bash
2
3 dockerdir=./build/docker
4 if [ ! -d "$dockerdir" ]; then
5 echo "Run this script from the build root"
6 exit 2
7 fi
8
9 version="$1"
10 platform="$2"
11
12 if [ -z "$platform" ] || [ -z "$version" ] || [ -n "$3" ]; then
13 echo "Usage: $0 <version> <platform>"
14 echo "where <platform> matches the suffix of the Docker file, e.g. ubuntu1604"
15 exit 2
16 fi
17
18 set -eu
19
20 echo "Building for version $version, platform $platform"
21 dockerfile="Dockerfile_v${version}_${platform}"
22
23 if [ ! -f "$dockerdir/$dockerfile" ]; then
24 echo "No matching docker file $dockerfile found in $dockerdir"
25 exit 1
26 fi
27
28 dockertag="cannam/vamp-plugin-sdk-$platform"
29
30 sudo docker build -t "$dockertag" -f "$dockerdir/$dockerfile" "$dockerdir"
31
32 outdir="$dockerdir/output"
33 mkdir -p "$outdir"
34
35 container=$(sudo docker create "$dockertag")
36 sudo docker cp "$container":output.tar "$outdir"
37 sudo docker rm "$container"
38
39 ( cd "$outdir" ; tar xf output.tar && rm -f output.tar )
40
41 echo
42 echo "Done, output directory contains:"
43 ls -ltr "$outdir"