Skip to content

Commit

Permalink
✨ add dockerfile for sm86
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryo Okada committed Feb 5, 2022
1 parent ebfa8e3 commit 2f8911f
Showing 1 changed file with 102 additions and 0 deletions.
102 changes: 102 additions & 0 deletions Dockerfile_gym_sm86
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
FROM nvidia/cuda:10.2-cudnn8-devel-ubuntu18.04

RUN apt-get update -q \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl \
git \
libgl1-mesa-dev \
libgl1-mesa-glx \
libglew-dev \
libosmesa6-dev \
software-properties-common \
net-tools \
vim \
virtualenv \
wget \
xpra \
xserver-xorg-dev \
cmake \
protobuf-compiler \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN DEBIAN_FRONTEND=noninteractive add-apt-repository --yes ppa:deadsnakes/ppa && apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install --yes python3.8-dev python3.8 python3-pip python3.8-distutils
# RUN virtualenv --python=python3.8 env

RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python3.8 get-pip.py

RUN rm /usr/bin/python
RUN ln -s /usr/bin/python3.8 /usr/bin/python
RUN ln -s /usr/local/bin/pip3.8 /usr/bin/pip
# RUN ln -s /env/bin/pytest /usr/bin/pytest

RUN curl -o /usr/local/bin/patchelf https://s3-us-west-2.amazonaws.com/openai-sci-artifacts/manual-builds/patchelf_0.9_amd64.elf \
&& chmod +x /usr/local/bin/patchelf

ENV LANG C.UTF-8

RUN mkdir -p /root/.mujoco \
&& wget https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz -O mujoco.tar.gz \
&& tar -xf mujoco.tar.gz -C /root/.mujoco \
&& rm mujoco.tar.gz

ENV LD_LIBRARY_PATH /root/.mujoco/mujoco210/bin:${LD_LIBRARY_PATH}
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib64:${LD_LIBRARY_PATH}

COPY mujoco-py/vendor/Xdummy /usr/local/bin/Xdummy
RUN chmod +x /usr/local/bin/Xdummy

# Workaround for https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-375/+bug/1674677
COPY mujoco-py/vendor/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json

WORKDIR /mujoco_py
# Copy over just requirements.txt at first. That way, the Docker cache doesn't
# expire until we actually change the requirements.
# COPY ./mujoco-py/requirements.txt /mujoco_py/
# COPY ./mujoco-py/requirements.dev.txt /mujoco_py/
# RUN pip install --no-cache-dir -r requirements.txt
# RUN pip install --no-cache-dir -r requirements.dev.txt

RUN wget -P /opt https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash /opt/Miniconda3-latest-Linux-x86_64.sh -b && \
rm /opt/Miniconda3-latest-Linux-x86_64.sh && \
~/miniconda3/bin/conda init bash && \
. ~/.bashrc
ADD ./gym/conda_env.yml /tmp/conda_env.yml
RUN ~/miniconda3/bin/conda env create -f /tmp/conda_env.yml
RUN echo "conda activate decision-transformer-gym" >> ~/.bashrc

# d4rl
WORKDIR /
RUN git clone https://github.com/ryok/d4rl.git
WORKDIR /d4rl
RUN ~/miniconda3/envs/decision-transformer-gym/bin/pip install -e .
RUN ~/miniconda3/envs/decision-transformer-gym/bin/pip install dm-control==0.0.423341706

WORKDIR /mujoco_py
# Delay moving in the entire code until the very end.
ENTRYPOINT ["/mujoco_py/vendor/Xdummy-entrypoint"]
# CMD ["pytest"]
COPY ./mujoco-py/ /mujoco_py
RUN ~/miniconda3/envs/decision-transformer-gym/bin/python setup.py install

# pytorch build
WORKDIR /
RUN ~/miniconda3/bin/conda install cudatoolkit=10.2 -c pytorch
# RUN wget -P / https://github.com/Kitware/CMake/releases/download/v3.17.1/cmake-3.17.1.tar.gz && \
# tar zxvf cmake-3.17.1.tar.gz
# WORKDIR /cmake-3.17.1
# RUN ./bootstrap && \
# make && \
# make install
WORKDIR /
RUN git clone --recursive https://github.com/pytorch/pytorch -b v1.8.1
WORKDIR /pytorch
RUN git submodule sync && \
git submodule update --init --recursive
ENV CMAKE_PREFIX_PATH ${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
RUN ~/miniconda3/envs/decision-transformer-gym/bin/python setup.py install

WORKDIR /workspace

0 comments on commit 2f8911f

Please sign in to comment.