ci-docker.sh 991 Bytes
Newer Older
1 2
#!/bin/bash

3
set -e
4

5 6 7 8
if test -z "$DEBIAN_VERSION"; then
    DEBIAN_VERSION="stable"
fi

9 10 11 12
if test -z "$COMPILER"; then
    COMPILER="system"
fi

13 14 15 16 17 18
if test "$COMPILER" = "system"; then
    OCAML="ocaml-system"
else
    OCAML="ocaml-base-compiler.$COMPILER"
fi

19
autoconf && (automake --add-missing 2> /dev/null || true)
20 21 22 23
IMAGE=bench-image-$COMPILER-$DEBIAN_VERSION

if test -n "$DEBIAN_PACKAGES"; then
 IMAGE=$IMAGE--$(echo $DEBIAN_PACKAGES | sed -e 's/ /--/g')
24
fi
25 26 27 28 29

if test -n "$OPAM_PACKAGES"; then
 IMAGE=$IMAGE--$(echo $OPAM_PACKAGES   | sed -e 's/ /--/g')
fi

30
docker build -t $IMAGE --force-rm -f misc/Dockerfile.init --build-arg debian_version="$DEBIAN_VERSION" --build-arg compiler=$OCAML --build-arg debian_packages="$DEBIAN_PACKAGES" --build-arg opam_packages="$OPAM_PACKAGES" .
31
CID=$(docker create --rm -i -w /home/why3/why3 $IMAGE /bin/sh)
32 33 34 35 36 37
docker start $CID
docker cp . $CID:/home/why3/why3
docker exec -u root $CID chown -R why3:why3 /home/why3/why3
docker attach $CID <<EOF
exec $@
EOF