ray/build-docker.sh
Feynman Liang 7825aed230 Fix build-docker.sh bug (#515)
* Build examples by default

The [documentation](http://ray.readthedocs.io/en/latest/install-on-docker.html#build-docker-images)  says that the `examples` image is built by `build-docker.sh` script.

* Update build-docker.sh
2017-05-06 18:57:08 -07:00

55 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--no-cache)
NO_CACHE="--no-cache"
;;
--skip-examples)
SKIP_EXAMPLES=YES
;;
--output-sha)
# output the SHA sum of the last built file (either ray-project/deploy
# or ray-project/examples, suppressing all other output. This is useful
# for scripting tests, especially when builds of different versions
# are running on the same machine. It also can facilitate cleanup.
OUTPUT_SHA=YES
;;
*)
echo "Usage: build-docker.sh [ --no-cache ] [ --skip-examples ] [ --sha-sums ]"
exit 1
esac
shift
done
# Build base dependencies, allow caching
if [ $OUTPUT_SHA ]; then
IMAGE_SHA=$(docker build $NO_CACHE -q -t ray-project/base-deps docker/base-deps)
else
docker build $NO_CACHE -t ray-project/base-deps docker/base-deps
fi
# Build the current Ray source
git rev-parse HEAD > ./docker/deploy/git-rev
git archive -o ./docker/deploy/ray.tar $(git rev-parse HEAD)
if [ $OUTPUT_SHA ]; then
IMAGE_SHA=$(docker build --no-cache -q -t ray-project/deploy docker/deploy)
else
docker build --no-cache -t ray-project/deploy docker/deploy
fi
rm ./docker/deploy/ray.tar ./docker/deploy/git-rev
# Build the examples, unless skipped
if [ ! $SKIP_EXAMPLES ]; then
if [ $OUTPUT_SHA ]; then
IMAGE_SHA=$(docker build $NO_CACHE -q -t ray-project/examples docker/examples)
else
docker build --no-cache -t ray-project/examples docker/examples
fi
fi
if [ $OUTPUT_SHA ]; then
echo $IMAGE_SHA | sed 's/sha256://'
fi