diff --git a/build-docker.sh b/build-docker.sh index b233a2f33..fdb7749d8 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -1,5 +1,8 @@ #!/bin/bash -docker build -t ray-project/ray:devel docker/devel -docker build -t ray-project/ray:deploy docker/deploy -docker build -t ray-project/ray:examples docker/examples +docker build -t ray-project/base-deps docker/base-deps + +tar --exclude './docker' -c . > ./docker/deploy/ray.tar +docker build --no-cache -t ray-project/deploy docker/deploy +rm ./docker/deploy/ray.tar +docker build -t ray-project/examples docker/examples diff --git a/docker/base-deps/Dockerfile b/docker/base-deps/Dockerfile new file mode 100644 index 000000000..f193dccad --- /dev/null +++ b/docker/base-deps/Dockerfile @@ -0,0 +1,18 @@ +# The deploy Docker image build a self-contained Ray instance suitable +# for end users. + +FROM ubuntu:xenial +RUN apt-get update \ + && apt-get install -y vim git wget \ + && apt-get install -y cmake build-essential autoconf curl libtool libboost-all-dev unzip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* +RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh \ + && wget --quiet 'https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh' -O /tmp/anaconda.sh \ + && /bin/bash /tmp/anaconda.sh -b -p /opt/conda \ + && rm /tmp/anaconda.sh +ENV PATH "/opt/conda/bin:$PATH" +RUN conda install libgcc +RUN pip install --upgrade pip +RUN pip install --upgrade "git+git://github.com/cloudpipe/cloudpickle.git@0d225a4695f1f65ae1cbb2e0bbc145e10167cce4" +RUN pip install --upgrade --verbose "git+git://github.com/ray-project/ray.git#egg=numbuf&subdirectory=numbuf" diff --git a/docker/deploy/Dockerfile b/docker/deploy/Dockerfile index 6e9044e0a..f9943c127 100644 --- a/docker/deploy/Dockerfile +++ b/docker/deploy/Dockerfile @@ -1,21 +1,8 @@ # The deploy Docker image build a self-contained Ray instance suitable # for end users. -FROM ubuntu:xenial -RUN apt-get update -RUN apt-get -y install apt-utils -RUN apt-get -y install sudo -RUN apt-get install -y git cmake build-essential autoconf curl libtool python-dev python-numpy python-pip libboost-all-dev unzip graphviz -RUN pip install ipython funcsigs subprocess32 protobuf colorama graphviz -RUN pip install --upgrade git+git://github.com/cloudpipe/cloudpickle.git@0d225a4695f1f65ae1cbb2e0bbc145e10167cce4 # We use the latest version of cloudpickle because it can serialize named tuples. -RUN adduser --gecos --ingroup ray-user --disabled-login --gecos ray-user -RUN adduser ray-user sudo -RUN sed -i "s|%sudo\tALL=(ALL:ALL) ALL|%sudo\tALL=NOPASSWD: ALL|" /etc/sudoers -USER ray-user -WORKDIR /home/ray-user -RUN git clone https://github.com/ray-project/ray -WORKDIR /home/ray-user/ray -RUN ./setup.sh -RUN ./build.sh -RUN echo '\n# Ray environment\nsource /home/ray-user/ray/setup-env.sh' >> /home/ray-user/.bashrc -ENTRYPOINT bash +FROM ray-project/base-deps +ADD ray.tar /ray +WORKDIR /ray/lib/python +RUN python setup.py install +WORKDIR /ray diff --git a/docker/devel/Dockerfile b/docker/devel/Dockerfile deleted file mode 100644 index 9b1fdcbae..000000000 --- a/docker/devel/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# The devel Docker image is designed for use with a source checkout -# mounted from the local host filesystem. - -FROM ubuntu:xenial -RUN apt-get update -RUN apt-get -y install apt-utils -RUN apt-get -y install sudo -RUN apt-get install -y git cmake build-essential autoconf curl libtool python-dev python-numpy python-pip libboost-all-dev unzip graphviz -RUN pip install ipython funcsigs subprocess32 protobuf colorama graphviz -RUN pip install --upgrade git+git://github.com/cloudpipe/cloudpickle.git@0d225a4695f1f65ae1cbb2e0bbc145e10167cce4 # We use the latest version of cloudpickle because it can serialize named tuples. -RUN adduser --gecos --ingroup ray-user --disabled-login --gecos ray-user --uid 500 -RUN adduser ray-user sudo -RUN sed -i "s|%sudo\tALL=(ALL:ALL) ALL|%sudo\tALL=NOPASSWD: ALL|" /etc/sudoers -USER ray-user -WORKDIR /home/ray-user -RUN mkdir /home/ray-user/ray-build -RUN mkdir /home/ray-user/ray -RUN ln -s /home/ray-user/ray-build /home/ray-user/ray/build -ENTRYPOINT bash diff --git a/docker/examples/Dockerfile b/docker/examples/Dockerfile index 7b0e21c7d..db469a2fb 100644 --- a/docker/examples/Dockerfile +++ b/docker/examples/Dockerfile @@ -1,14 +1,6 @@ -# Bulding on top of deploy image, this Dockerfile adds libraries needed -# for running examples. +# The examples Docker image adds dependencies needed to run the examples -FROM ray-project/ray:deploy - -# Tensorflow -RUN pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl - -# SciPy -RUN pip install scipy - -# Gym -RUN sudo apt-get -y install zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libsdl2-dev swig wget +FROM ray-project/deploy +RUN conda install -y -c conda-forge tensorflow +RUN apt-get install zlib1g-dev RUN pip install gym[atari] diff --git a/docker/test-base/Dockerfile b/docker/test-base/Dockerfile deleted file mode 100644 index d741b3c17..000000000 --- a/docker/test-base/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Base image for tests. This differs from the deploy image in that -# rather than downloading source code from github it instead adds -# it from a tar file creaetd by test/travis-ci/install.sh - -FROM ubuntu:xenial -RUN apt-get update -RUN apt-get -y install apt-utils -RUN apt-get -y install sudo -RUN apt-get install -y git cmake build-essential autoconf curl libtool python-dev python-numpy python-pip libboost-all-dev unzip graphviz -RUN pip install ipython funcsigs subprocess32 protobuf colorama graphviz -RUN pip install --upgrade git+git://github.com/cloudpipe/cloudpickle.git@0d225a4695f1f65ae1cbb2e0bbc145e10167cce4 # We use the latest version of cloudpickle because it can serialize named tuples. -RUN adduser --gecos --ingroup ray-user --disabled-login --gecos ray-user -RUN adduser ray-user sudo -RUN sed -i "s|%sudo\tALL=(ALL:ALL) ALL|%sudo\tALL=NOPASSWD: ALL|" /etc/sudoers -ADD ray.tar /home/ray-user/ray -RUN chown -R ray-user.ray-user /home/ray-user/ray -USER ray-user -WORKDIR /home/ray-user/ray -RUN ./setup.sh -RUN ./build.sh diff --git a/docker/test-examples/Dockerfile b/docker/test-examples/Dockerfile deleted file mode 100644 index e3e70a30d..000000000 --- a/docker/test-examples/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -# Bulding on top of base test image, this Dockerfile adds libraries -# needed for running additional examples. - -FROM ray-project/ray:test-base - -# Tensorflow -RUN pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl - -# SciPy -RUN pip install scipy