-
Notifications
You must be signed in to change notification settings - Fork 0
/
container.def
93 lines (79 loc) · 3.05 KB
/
container.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
BootStrap: docker
From: python:3.8.11-buster
%files
requirements.txt /usr/project/python/requirements.txt
scripts/rm_mujoco_lock.sh /usr/project/mujoco/rm_mujoco_lock.sh
dask_config.yml /etc/dask/dask_config.yml
%post
# Apt packages - Note: If we install Python here (as opposed to building
# from a Python container) we end up with one of the old versions in the
# apt repositories.
apt-get update
apt-get install -y \
wget \
git \
zip \
unzip \
libgl1-mesa-dev \
libgl1-mesa-glx \
mesa-utils \
libglew-dev \
libosmesa6-dev \
patchelf \
ffmpeg
# Microsoft fonts (particularly Times)
# https://stackoverflow.com/questions/60934639/install-fonts-in-linux-container-for-asp-net-core#62888227
sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list
apt-get update
apt-get install -y ttf-mscorefonts-installer fontconfig
fc-cache -f -v
# For pyvirtualdisplay https://github.com/ponty/pyvirtualdisplay/
apt-get install -y \
xvfb \
xserver-xephyr \
tigervnc-standalone-server \
xfonts-base
apt-get clean
rm -rf /var/lib/apt/lists/*
# Project
PROJECT_ROOT=/usr/project
mkdir -p $PROJECT_ROOT
# Python - this must go before MuJoCo because MuJoCo installs the highest
# numpy version available if numpy is not installed already. This numpy
# version would mismatch with the version (1.20.2) in requirements.txt,
# which would crash pybullet since pybullet would be compiled with 1.20.2
# but be running with a later version.
pip3 install -r $PROJECT_ROOT/python/requirements.txt
# MuJoCo
mkdir -p $PROJECT_ROOT/mujoco
wget https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz
tar -xzvf mujoco210-linux-x86_64.tar.gz
mv mujoco210 $PROJECT_ROOT/mujoco/mujoco210
rm mujoco210-linux-x86_64.tar.gz
# mujoco-py
bash /usr/project/mujoco/rm_mujoco_lock.sh
export MUJOCO_PY_MUJOCO_PATH=$PROJECT_ROOT/mujoco/mujoco210
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PROJECT_ROOT/mujoco/mujoco210/bin
git clone https://github.com/icaros-usc/mujoco-py --depth 1 $PROJECT_ROOT/mujoco/mujoco-py
cd $PROJECT_ROOT/mujoco/mujoco-py
git reset --hard 53e78f2 # Pin to specific commit.
pip3 install --no-cache-dir -r requirements.txt
pip3 install --no-cache-dir -r requirements.dev.txt
python3 setup.py build install
cd -
bash /usr/project/mujoco/rm_mujoco_lock.sh
%environment
export PROJECT_ROOT=/usr/project
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PROJECT_ROOT/mujoco/mujoco210/bin
export MUJOCO_PY_MUJOCO_PATH=$PROJECT_ROOT/mujoco/mujoco210
# So that MuJoCo visualization works (see
# https://github.com/openai/mujoco-py/issues/268)
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so
# Set X11 display for GUI output
export DISPLAY=":1"
# Set numpy to be single-threaded
export OPENBLAS_NUM_THREADS=1
# Detect package
export PYTHONPATH="."
%runscript
echo "No runscript specified"