-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathDockerfile.carla
More file actions
109 lines (87 loc) · 3.58 KB
/
Dockerfile.carla
File metadata and controls
109 lines (87 loc) · 3.58 KB
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
FROM carlasim/carla:0.9.15
USER root
ARG HTTP_PROXY
ARG HTTPS_PROXY
ENV http_proxy=${HTTP_PROXY}
ENV https_proxy=${HTTPS_PROXY}
ENV HTTP_PROXY=${HTTP_PROXY}
ENV HTTPS_PROXY=${HTTPS_PROXY}
RUN echo "Using proxy: $HTTP_PROXY" && env | grep -i proxy
SHELL ["/bin/bash", "-c"]
# Add retry helper
RUN printf '#!/bin/bash\nfor i in {1..6}; do "$@" && break || sleep 10; done\n' > /usr/local/bin/retry && \
chmod +x /usr/local/bin/retry
# Install dependencies
RUN retry apt-get -o Acquire::http::Proxy="$HTTP_PROXY" \
-o Acquire::https::Proxy="$HTTPS_PROXY" \
update && \
retry apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
curl \
wget \
vim \
ca-certificates \
libjpeg-dev \
libpng16-16 \
libtiff5 \
libpng-dev \
python3-dev \
python3-pip \
python3-setuptools && \
python3 -m pip install --upgrade pip && \
rm -rf /var/lib/apt/lists/*
# Install conda
ENV CONDA_ALWAYS_YES=1
ENV CONDA_OVERRIDE_CHANNELS=1
RUN set -e; \
RETRIES=5; \
until curl -o ~/miniconda.sh -LO https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh; do \
RETRIES=$((RETRIES-1)); \
if [ $RETRIES -le 0 ]; then echo "Failed to download miniconda.sh"; exit 1; fi; \
echo "Retry downloading miniconda.sh..."; sleep 3; \
done && \
bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda clean -ya
ENV PATH="/opt/conda/bin:$PATH"
# Create workdir & copy files
ENV WORKDIR=/workspace/Bench2Drive-VL
WORKDIR ${WORKDIR}
ENV CARLA_ROOT="/home/carla"
ENV SCENARIO_RUNNER_ROOT="${WORKDIR}/scenario_runner"
ENV LEADERBOARD_ROOT="${WORKDIR}/leaderboard"
ENV TEAM_CODE_ROOT="${WORKDIR}/team_code"
ENV ADAPTER_ROOT="${WORKDIR}/B2DVL_Adapter"
ENV VQA_GEN=1
ENV STRICT_MODE=1
COPY . ${WORKDIR}
COPY requirements.txt /tmp/requirements.txt
# Accept ToS + create conda env
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && \
(for i in {1..6}; do conda create -n b2dvl python=3.7 numpy networkx scipy six requests -y && break || sleep 5; done)
# requirements.txt
RUN for i in {1..6}; do conda run -n b2dvl pip install -r ${SCENARIO_RUNNER_ROOT}/requirements.txt && break || sleep 5; done && \
for i in {1..6}; do conda run -n b2dvl pip install -r ${LEADERBOARD_ROOT}/requirements.txt && break || sleep 5; done && \
for i in {1..6}; do conda run -n b2dvl pip install -r /tmp/requirements.txt && break || sleep 5; done
# PyTorch
RUN for i in {1..6}; do conda run -n b2dvl pip install torch torchvision torchaudio --extra-index-url https://pypi.org/simple && break || sleep 5; done
# activate conda
RUN echo "source /opt/conda/etc/profile.d/conda.sh" >> /etc/bash.bashrc && \
echo "conda activate b2dvl" >> /etc/bash.bashrc
# Set Python path
ENV PYTHONPATH="${CARLA_ROOT}/PythonAPI:${CARLA_ROOT}/PythonAPI/carla:${CARLA_ROOT}/PythonAPI/carla/dist/carla-0.9.15-py3.7-linux-x86_64.egg:${SCENARIO_RUNNER_ROOT}:${LEADERBOARD_ROOT}:${TEAM_CODE_ROOT}:${ADAPTER_ROOT}:${PYTHONPATH}"
RUN chmod +x ${LEADERBOARD_ROOT}/scripts/run_evaluation.sh
# Additional maps
RUN cd /home/carla/Import && \
if [ ! -f AdditionalMaps_0.9.15.tar.gz ]; then \
wget https://carla-releases.s3.us-east-005.backblazeb2.com/Linux/AdditionalMaps_0.9.15.tar.gz; \
fi && \
cd .. && \
bash ImportAssets.sh
# switch back to carla user
USER carla
WORKDIR ${WORKDIR}
CMD ["/bin/bash"]