forked from deepdrive/deepdrive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
127 lines (102 loc) · 3.15 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Requires NVIDIA drivers 390+
#
# Build (automated on dockerhub, so just use for local testing, don't push):
#
# Local usage: See Makefile
#
# VERSION=`cat VERSION | sed 's/ //g'`
# docker build --build-arg version=$VERSION -t deepdriveio/deepdrive:$VERSION -f Dockerfile .
#
# Usage:
# VERSION=`cat VERSION | sed 's/ //g
# docker run -it --net=host --runtime=nvidia deepdriveio/deepdrive:$VERSION
# Ubuntu 18
FROM adamrehn/ue4-runtime:tensorflow-virtualgl
#FROM nvidia/opengl:1.0-glvnd-runtime-ubuntu16.04
# For Ubuntu 16 also install
# python-software-properties
ARG update_sim=True
USER root
# OS dependencies
RUN apt-get update; apt-get install -y \
libsdl2-2.0 \
software-properties-common \
sudo \
# python3-venv \
python3-pip \
python3-dev \
ffmpeg \
git \
vim \
wget \
&& cd /usr/local/bin \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Give the ue4 user the ability to install pip packages
ARG user=ue4
ENV DEEPDRIVE_USER=$user
#RUN chown -R $user:$user /home/$user
RUN adduser $user sudo
RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Ensure ue4 owns directories needed to run Deepdrive
#RUN sudo chown -R $user:$user /home/$user
ENV DEEPDRIVE_SRC_DIR=/home/$user/src/deepdrive
WORKDIR $DEEPDRIVE_SRC_DIR
#RUN sudo chown -R $user:$user .
#RUN sudo chmod -R 775 /home/$user
# Create our virtual environment
#ARG venv=deepdrive_venv
#RUN python -m venv /home/$user/$venv
#ENV VIRTUAL_ENV /home/$user/$venv
#ENV PATH /home/$user/$venv/bin:$PATH
RUN which pip
# Get the latest pip within the virtual environment
RUN pip install --upgrade pip
RUN which pip
# Install tensorflow
RUN pip install tensorflow-gpu
# Install OpenCV for web renderer
RUN pip install opencv-python
# Nice to have ipython in the container for bashing in
RUN pip install ipython
# Set Deepdrive directory so that we are not prompted to enter it interactively
ENV DEEPDRIVE_DIR=/home/$user/Deepdrive
# Cache pip requirements
COPY requirements.txt ./
RUN pip install -r requirements.txt
USER $user
# Copy minimum files needed for sim download
COPY config/ ./config/
COPY util/anonymize.py ./util/anonymize.py
COPY util/run_command.py ./util/run_command.py
COPY util/download.py ./util/download.py
COPY util/ensure_sim.py ./util/ensure_sim.py
COPY util/get_directories.py ./util/get_directories.py
COPY VERSION logs.py ./
# Download sim
RUN python -c "from util.ensure_sim import ensure_sim; ensure_sim(update=$update_sim);"
# Install
COPY install.py ./
USER root
RUN python -u install.py
USER $user
# Commands useful for debugging
#ENV PYTHONPATH=/home/$user/src/deepdrive:$PYTHONPATH
#RUN which pip
#RUN pip install wheel
#RUN pip install "deepdrive > $version.*dev0" # TODO: Remove dev0 after 3.0 stable release
#RUN pip install sarge
#RUN pip install -r requirements.txt
#COPY logs.py utils.py install.py ./
# LibSDL2 offscreen opengl mode
ENV SDL_VIDEODRIVER=offscreen
# API
EXPOSE 5557/tcp
COPY . .
#ENTRYPOINT ["/bin/bash", "docker/entrypoint.bash"]
CMD python main.py --server
# TODO: Support
# 1) Eval
# 2) Experiement
# 3) CI