forked from HumanCompatibleAI/adversarial-policies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
94 lines (81 loc) · 2.93 KB
/
Dockerfile
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
94
# Based on OpenAI's mujoco-py Dockerfile
ARG USE_MPI=True
# base stage contains just binary dependencies.
# This is used in the CI build.
FROM nvidia/cuda:10.0-runtime-ubuntu18.04 AS base
ARG USE_MPI
ARG DEBIAN_FRONTEND=noninteractive
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections \
&& apt-get update -q \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
ffmpeg \
git \
libgl1-mesa-dev \
libgl1-mesa-glx \
libglew-dev \
libosmesa6-dev \
net-tools \
parallel \
patchelf \
python3.7 \
python3.7-dev \
python3-pip \
rsync \
software-properties-common \
unzip \
vim \
virtualenv \
xpra \
xserver-xorg-dev \
ttf-mscorefonts-installer \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV LANG C.UTF-8
RUN mkdir -p /root/.mujoco \
&& curl -o mjpro150.zip https://www.roboti.us/download/mjpro150_linux.zip \
&& unzip mjpro150.zip -d /root/.mujoco \
&& rm mjpro150.zip \
&& curl -o mujoco131.zip https://www.roboti.us/download/mjpro131_linux.zip \
&& unzip mujoco131.zip -d /root/.mujoco \
&& rm mujoco131.zip \
&& curl -o /root/.mujoco/mjkey.txt https://www.roboti.us/file/mjkey.txt
COPY vendor/Xdummy /usr/local/bin/Xdummy
RUN chmod +x /usr/local/bin/Xdummy
RUN if [ $USE_MPI = "True" ]; then \
add-apt-repository --yes ppa:marmistrz/openmpi \
&& apt-get update -q \
&& apt-get install -y libopenmpi3 libopenmpi-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*; \
fi
# Set the PATH to the venv before we create the venv, so it's visible in base.
# This is since we may create the venv outside of Docker, e.g. in CI
# or by binding it in for local development.
ENV PATH="/venv/bin:$PATH"
ENV LD_LIBRARY_PATH /root/.mujoco/mjpro150/bin:${LD_LIBRARY_PATH}
# python-req stage contains Python venv, but not code.
# It is useful for development purposes: you can mount
# code from outside the Docker container.
FROM base as python-req
ARG USE_MPI
WORKDIR /adversarial-policies
# Copy over just requirements.txt at first. That way, the Docker cache doesn't
# expire until we actually change the requirements.
COPY ./requirements-build.txt /adversarial-policies/
COPY ./requirements.txt /adversarial-policies/
COPY ./requirements-dev.txt /adversarial-policies/
COPY ./ci/build_venv.sh /adversarial-policies/ci/build_venv.sh
RUN ci/build_venv.sh /venv && rm -rf $HOME/.cache/pip
# full stage contains everything.
# Can be used for deployment and local testing.
FROM python-req as full
# Delay copying (and installing) the code until the very end
COPY . /adversarial-policies
# Build a wheel then install to avoid copying whole directory (pip issue #2195)
RUN python3 setup.py sdist bdist_wheel
RUN pip install --upgrade dist/aprl-*.whl
# Default entrypoints
ENTRYPOINT ["/adversarial-policies/vendor/Xdummy-entrypoint"]
CMD ["ci/run_tests.sh"]