Skip to content

Commit

Permalink
test dockerfiles for ubuntu 14.04 and 18.04 (openai#1168)
Browse files Browse the repository at this point in the history
* pass device_id=-1 when rendering mujoco in rgb_array mode

* trying ubuntu18.04 build

* use travis build matrix

* use travis build matrix

* use travis build matrix

* use fix 18.04 installation steps

* use fix 18.04 installation steps

* try py3 instead of py35

* trying the 14.04 build; cleaning up the 16.04 package list

* fixes to dockerfile.14.04

* fixes to dockerfile.14.04

* fixes to dockerfile.14.04

* fixes to dockerfile.14.04

* fixes to dockerfile.14.04

* fixing system package list for 14.04

* 16.04 build working

* clean up test.dockerfile.16.04

* adding python-numpy system package

* add patchelf

* remove python-numpy from 16.04 dockerfile

* 14.04 does not use mujoco (patchelf problem)

* cleaning up 18.04 dockerfile

* added comment to 14.04 dockerfile

* fix syntax in 14.04 dockerfile

* being fancy and switching from apt-get to apt command in 18.04 dockerfile

* update README.rst to use apt (instead of apt-get) on ubuntu 18.04
  • Loading branch information
pzhokhov authored Sep 21, 2018
1 parent 7bbe486 commit 69f5f98
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 69 deletions.
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ sudo: required
language: python
services:
- docker
before_install:
- docker build -f test.dockerfile -t gym-test .
env:
- UBUNTU_VER=14.04
- UBUNTU_VER=16.04
- UBUNTU_VER=18.04

install: "" # so travis doesn't do pip install requirements.txt
script:
- docker build -f test.dockerfile.${UBUNTU_VER} -t gym-test .
- docker run -e MUJOCO_KEY=$MUJOCO_KEY gym-test tox

notifications:
slack:
secure: h/Mxm8K+avH/2W0818zCHmLloRPMFN4NJL01+VShvAkH80/acfjeq/+mMdWXXPL/oOB6kSHDk+GDhwR6+s03ZcPMn5INTFvFYqUc6UWmT+NXtOPxGTN0xda6MdYUkWQUKaMyjFrweZQOMOASFBIzPOq4XeVbM5aB8s4EJhnfAcYZhp/idwKbToVihN4KZgxlvZIFc8iEp1o9uSl5qrsaeYYYXRkb6mauacAwOo4/Chu+cOnoLUOnvhBFE3rV3doDNrbnoalO8XiExtgx5CIAYWrlMni7r2Q+LlzgwdyTH19ZtybPxJTZIIWSBQ2UtcoYdIEDcc36GcUwz1VUGg32mLJJnY2xw80CWR4ixFPpLwwP5Y99WTn8v094B4nmFTWOwNWXp3EkqtTN9XcJoRBqXB5ArucIPqrx57dOCljSKx22gL6WaF2p3stSAxIGFektGyGnisaELrFZG1C63aHoUPicj3gUlijmAoUmYaDRf6P1wnpXqBpKDAWWhAMSatvx1ekmEJgR7OQklQnnfjx9kENDUygNUWS4IQwN2qYieuzHFL3of7/30mTM43+Vt/vWN8GI7j01BXu6FNGGloHxjH1pt3bLP/+uj5BJsT2HWF+Z8XR4VE6cyVuKsQAFgCXwOkoDHALbcwsspONDIt/9ixkesgh1oFt4CzU3UuU5wYs=
on_success: change
42 changes: 0 additions & 42 deletions Dockerfile

This file was deleted.

20 changes: 16 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,37 @@ Installing everything

To install the full set of environments, you'll need to have some system
packages installed. We'll build out the list here over time; please let us know
what you end up installing on your platform.
what you end up installing on your platform. Also, take a look at the docker files (test.dockerfile.xx.xx) to
see the composition of our CI-tested images.

On OSX:

.. code:: shell
brew install cmake boost boost-python sdl2 swig wget
On Ubuntu 14.04:
On Ubuntu 14.04 (non-mujoco only):

.. code:: shell
apt-get install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
apt-get install libjpeg-dev cmake swig python-pyglet python3-opengl libboost-all-dev \
libsdl2-2.0.0 libsdl2-dev libglu1-mesa libglu1-mesa-dev libgles2-mesa-dev \
freeglut3 xfvb libav-tools
On Ubuntu 16.04:

.. code:: shell
apt-get install -y python-pyglet python3-opengl zlib1g-dev libjpeg-dev patchelf \
cmake swig libboost-all-dev libsdl2-dev libosmesa6-dev xvfb ffmpeg
On Ubuntu 18.04:

.. code:: shell
apt-get install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb ffmpeg xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
apt install -y python3-dev zlib1g-dev libjpeg-dev cmake swig python-pyglet python3-opengl libboost-all-dev libsdl2-dev \
libosmesa6-dev patchelf ffmpeg xvf
MuJoCo has a proprietary dependency we can't set up for you. Follow
the
Expand Down
4 changes: 3 additions & 1 deletion bin/docker_entrypoint
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/bash
# This script is the entrypoint for our Docker image.

set -ex
set -x

if [[ ! -z "$MUJOCO_KEY" ]]; then
echo $MUJOCO_KEY | base64 --decode > /root/.mujoco/mjkey.txt
fi

set -ex

# Set up display; otherwise rendering will fail
Xvfb -screen 0 1024x768x24 &
export DISPLAY=:0
Expand Down
3 changes: 1 addition & 2 deletions gym/envs/mujoco/mujoco_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,9 @@ def _get_viewer(self, mode):
if self.viewer is None:
if mode == 'human':
self.viewer = mujoco_py.MjViewer(self.sim)

elif mode == 'rgb_array' or mode == 'depth_array':
self.viewer = mujoco_py.MjRenderContextOffscreen(self.sim, -1)

self.viewer_setup()
self._viewers[mode] = self.viewer
return self.viewer
Expand Down
46 changes: 46 additions & 0 deletions test.dockerfile.14.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# A Dockerfile that sets up a full Gym install with test dependencies
FROM ubuntu:14.04
# Note that latest version of mujoco-py, 1.5, does not play nicely with ubuntu 14.04 -
# requires patchelf system package not available on 14.04

# Install keyboard-configuration separately to avoid travis hanging waiting for keyboard selection
RUN \
apt-get -y update && \
apt-get install -y keyboard-configuration && \

apt-get install -y \
python-setuptools \
python-pip \
python3-dev \
libjpeg-dev \
cmake \
swig \
python-pyglet \
python3-opengl \
libboost-all-dev \
libsdl2-2.0.0 \
libsdl2-dev \
libglu1-mesa \
libglu1-mesa-dev \
libgles2-mesa-dev \
xvfb \
libav-tools \
freeglut3 \
wget \
unzip && \

apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
pip install tox


ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mjpro150/bin

# install dependencies
COPY . /usr/local/gym/
RUN cd /usr/local/gym && \
tox --notest

WORKDIR /usr/local/gym/
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
CMD ["tox"]
16 changes: 5 additions & 11 deletions test.dockerfile → test.dockerfile.16.04
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,21 @@ RUN \
apt-get install -y \
python-setuptools \
python-pip \
libpq-dev \
python3-dev \
python-pyglet \
python3-opengl \
zlib1g-dev \
libjpeg-dev \
curl \
cmake \
swig \
python-opengl \
python-numpy \
python-pyglet \
python3-opengl \
libboost-all-dev \
libsdl2-dev \
libosmesa6-dev \
patchelf \
wget \
unzip \
git \
vim \
xvfb \
ffmpeg \
python3-dev && \
wget \
unzip && \

apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
Expand Down
47 changes: 47 additions & 0 deletions test.dockerfile.18.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# A Dockerfile that sets up a full Gym install with test dependencies
FROM ubuntu:18.04

# Install keyboard-configuration separately to avoid travis hanging waiting for keyboard selection
RUN \
apt -y update && \
apt install -y keyboard-configuration && \

apt install -y \
python-setuptools \
python-pip \
python3-dev \
python-pyglet \
python3-opengl \
zlib1g-dev \
libjpeg-dev \
cmake \
swig \
libboost-all-dev \
libsdl2-dev \
libosmesa6-dev \
patchelf \
ffmpeg \
xvfb \
wget \
unzip && \

apt clean && \
rm -rf /var/lib/apt/lists/* && \
pip install tox && \

# Download mujoco
mkdir /root/.mujoco && \
cd /root/.mujoco && \
wget https://www.roboti.us/download/mjpro150_linux.zip && \
unzip mjpro150_linux.zip

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mjpro150/bin

# install dependencies
COPY . /usr/local/gym/
RUN cd /usr/local/gym && \
tox --notest

WORKDIR /usr/local/gym/
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
CMD ["tox"]
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# and then run "tox" from this directory.

[tox]
envlist = py35
envlist = py3

[testenv:py35]
[testenv:py3]
whitelist_externals=make
passenv=DISPLAY TRAVIS*
deps =
Expand Down

0 comments on commit 69f5f98

Please sign in to comment.