Chris@371: #!/bin/bash Chris@371: # Chris@371: # Docker required Chris@371: Chris@371: set -eu Chris@371: Chris@371: current=$(hg id | awk '{ print $1; }') Chris@371: Chris@371: case "$current" in Chris@371: *+) echo "ERROR: Current working copy has been modified - unmodified copy required so we know we can check it out separately and obtain the same contents"; exit 2;; Chris@371: *);; Chris@371: esac Chris@371: Chris@371: echo Chris@371: echo "Building appimage from revision $current..." Chris@371: Chris@371: dockerdir=deploy/linux/docker Chris@371: Chris@371: cat "$dockerdir"/Dockerfile_appimage.in | \ Chris@371: perl -p -e "s/\[\[REVISION\]\]/$current/g" > \ Chris@371: "$dockerdir"/Dockerfile_appimage.gen Chris@371: Chris@371: cat "$dockerdir"/Dockerfile_test_appimage.in | \ Chris@371: perl -p -e "s/\[\[REVISION\]\]/$current/g" > \ Chris@371: "$dockerdir"/Dockerfile_test_appimage.gen Chris@371: Chris@371: fgrep 'hg.sr.ht' ~/.ssh/known_hosts > "$dockerdir"/known_hosts Chris@371: cp ~/.ssh/id_rsa_build "$dockerdir"/id_rsa_build Chris@371: chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_rsa_build Chris@371: trap "rm $dockerdir/known_hosts $dockerdir/id_rsa_build" 0 Chris@371: Chris@371: dockertag="cannam/sonic-annotator-appimage-$current" Chris@371: Chris@371: sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_appimage.gen "$dockerdir" Chris@371: Chris@371: outdir="$dockerdir/output" Chris@371: mkdir -p "$outdir" Chris@371: Chris@371: container=$(sudo docker create "$dockertag") Chris@371: Chris@371: sudo docker cp "$container":output-appimage.tar "$outdir" Chris@371: sudo docker rm "$container" Chris@371: Chris@371: ( cd "$outdir" ; tar xf output-appimage.tar && rm -f output-appimage.tar ) Chris@371: Chris@371: sudo docker build -f "$dockerdir"/Dockerfile_test_appimage.gen "$dockerdir"