changeset 128:3a8658f7e0b7

Add script to run build in Docker
author Chris Cannam
date Thu, 07 Feb 2019 11:38:32 +0000
parents 622ddc1ace50
children 89f0fef1fccd
files SCRIPTS/Dockerfile_ubuntu1604.in SCRIPTS/dockerbuild.sh
diffstat 2 files changed, 70 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SCRIPTS/Dockerfile_ubuntu1604.in	Thu Feb 07 11:38:32 2019 +0000
@@ -0,0 +1,21 @@
+FROM ubuntu:16.04
+MAINTAINER Chris Cannam <cannam@all-day-breakfast.com>
+RUN apt-get update && \
+    apt-get install -y \
+    build-essential \
+    libsndfile-dev \
+    git mercurial subversion \
+    curl wget zip \
+    mlton \
+    python libpython2.7-dev python-numpy \
+    time valgrind
+RUN apt-get clean && rm -rf /var/lib/apt/lists/*
+RUN hg clone -r[[REVISION]] https://code.soundsoftware.ac.uk/hg/vamp-build-and-test
+WORKDIR vamp-build-and-test
+RUN ./SCRIPTS/update.sh [[REPO]] [[REPOREVISION]]
+RUN ./SCRIPTS/update.sh vamp-plugin-sdk
+RUN ./SCRIPTS/update.sh vamp-plugin-tester
+RUN ( cd vamp-plugin-tester && ./repoint update )
+RUN ./SCRIPTS/process.sh native -c [[REPO]]
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SCRIPTS/dockerbuild.sh	Thu Feb 07 11:38:32 2019 +0000
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# Docker required!
+
+if [ -z "$1" ] || [ -z "$2" ]; then
+    echo "Usage: $0 <repo> <repo-revision-id>"
+    exit 2
+fi
+
+platform=ubuntu1604
+dockerfile=SCRIPTS/Dockerfile_$platform
+
+mkdir -p "PACKAGES/$platform"
+
+if [ ! -f "$dockerfile.in" ]; then
+    echo "Docker file source $dockerfile.in not found (are we in the right directory?"
+    exit 1
+fi
+
+set -eu
+
+repo="$1"
+repo_revision="$2"
+
+current=$(hg id | awk '{ print $1; }')
+
+case "$current" in
+    *+) echo "WARNING: Current working copy has been modified - build will check out the last commit, which must perforce be different";;
+    *);;
+esac
+
+current=${current%%+}
+
+cat "$dockerfile.in" \
+    | perl -p -e 's/\[\[REVISION\]\]/'"$current"'/' \
+    | perl -p -e 's/\[\[REPO\]\]/'"$repo"'/' \
+    | perl -p -e 's/\[\[REPOREVISION\]\]/'"$repo_revision"'/' \
+           > "$dockerfile"
+
+dockertag="cannam/vamp-build-and-test-$current"
+
+sudo docker build -t "$dockertag" -f "$dockerfile" SCRIPTS
+
+container=$(sudo docker create "$dockertag")
+sudo docker cp "$container":vamp-build-and-test/PACKAGES/linux64/ "PACKAGES/$platform"/
+sudo docker rm "$container"
+
+echo "Done!"
+