Mercurial > hg > sonic-visualiser
annotate deploy/linux/docker/build.sh @ 1810:e988c01a3ab5
Tidy up rounding + tests
author | Chris Cannam |
---|---|
date | Thu, 10 May 2018 10:13:02 +0100 |
parents | 56b268b96fcb |
children | 12b96d6b1d66 |
rev | line source |
---|---|
Chris@1539 | 1 #!/bin/bash |
Chris@1539 | 2 |
Chris@1539 | 3 version=$(perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h | sed 's/-//g') |
Chris@1539 | 4 |
Chris@1539 | 5 dockerdir=./deploy/linux/docker |
Chris@1539 | 6 if [ ! -d "$dockerdir" ]; then |
Chris@1539 | 7 echo "Run this script from the build root" |
Chris@1539 | 8 exit 2 |
Chris@1539 | 9 fi |
Chris@1539 | 10 |
Chris@1539 | 11 platform="$1" |
Chris@1539 | 12 |
Chris@1539 | 13 if [ -z "$platform" ] || [ -n "$2" ]; then |
Chris@1539 | 14 echo "Usage: $0 <platform>" |
Chris@1539 | 15 echo "where <platform> matches the suffix of the Docker file, e.g. ubuntu1604" |
Chris@1539 | 16 exit 2 |
Chris@1539 | 17 fi |
Chris@1539 | 18 |
Chris@1539 | 19 set -eu |
Chris@1539 | 20 |
Chris@1539 | 21 echo "Building for version $version, platform $platform" |
Chris@1539 | 22 dockerfile="Dockerfile_v${version}_${platform}" |
Chris@1539 | 23 |
Chris@1539 | 24 if [ ! -f "$dockerdir/$dockerfile" ]; then |
Chris@1539 | 25 echo "No matching docker file $dockerfile found in $dockerdir" |
Chris@1539 | 26 exit 1 |
Chris@1539 | 27 fi |
Chris@1539 | 28 |
Chris@1539 | 29 dockertag="cannam/sonic-visualiser-$platform" |
Chris@1539 | 30 |
Chris@1539 | 31 sudo docker build -t "$dockertag" -f "$dockerdir/$dockerfile" "$dockerdir" |
Chris@1539 | 32 |
Chris@1539 | 33 outdir="$dockerdir/output" |
Chris@1539 | 34 mkdir -p "$outdir" |
Chris@1539 | 35 |
Chris@1539 | 36 container=$(sudo docker create "$dockertag") |
Chris@1539 | 37 sudo docker cp "$container":output.tar "$outdir" |
Chris@1539 | 38 sudo docker rm "$container" |
Chris@1539 | 39 |
Chris@1539 | 40 ( cd "$outdir" ; tar xf output.tar && rm -f output.tar ) |
Chris@1539 | 41 |
Chris@1539 | 42 echo |
Chris@1539 | 43 echo "Done, output directory contains:" |
Chris@1539 | 44 ls -ltr "$outdir" |