-
Notifications
You must be signed in to change notification settings - Fork 43
/
Dockerfile
72 lines (59 loc) · 4.5 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
FROM ros:kinetic
RUN apt-get update && apt-get install -y --no-install-recommends \
locales bzip2 tree unzip xz-utils curl wget iproute2 \
python-pip python3-pip python-setuptools python3-setuptools \
openjdk-8-jdk-headless \
&& rm -rf /var/lib/apt/lists/*
RUN python2 -m pip install --upgrade pip && \
python3 -m pip install --upgrade pip && \
pip3 install --no-cache-dir --upgrade jupyter && \
pip2 install --no-cache-dir --upgrade pyspark==3.0.1 matplotlib==2.2.3 setuptools==36.0.1 python-dateutil==2.5.0 pandas==0.23.2 numpy==1.13.3 six==1.11.0 tensorflow==1.9.0 keras==2.0.7 Pillow==6.2.2 && \
python2 -m pip install ipykernel && \
python2 -m ipykernel install && \
python3 -m pip install ipykernel && \
python3 -m ipykernel install
RUN pip2 install seaborn gmaps
RUN jupyter nbextension enable --py gmaps
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 66F84AE1EB71A8AC108087DCAF677210FF6D3CDA && \
bash -c 'echo "deb [ arch=amd64 ] http://packages.dataspeedinc.com/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-dataspeed-public.list' && \
apt-get update
RUN bash -c 'echo "yaml http://packages.dataspeedinc.com/ros/ros-public-'$ROS_DISTRO'.yaml '$ROS_DISTRO'" > /etc/ros/rosdep/sources.list.d/30-dataspeed-public-'$ROS_DISTRO'.list' && \
rosdep update 2>/dev/null && apt-get install -y --no-install-recommends \
ros-$ROS_DISTRO-dbw-mkz ros-$ROS_DISTRO-mobility-base ros-$ROS_DISTRO-baxter-sdk ros-$ROS_DISTRO-velodyne && \
rm -rf /var/lib/apt/lists/*
# Default to UTF-8
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV PATH $PATH:/opt/apache/hadoop/bin
ENV ROSIF_JAR /opt/ros_hadoop/master/lib/rosbaginputformat.jar
RUN mkdir -p /opt/ros_hadoop/latest
RUN mkdir -p /opt/ros_hadoop/master/dist/
RUN mkdir -p /opt/apache/
ADD . /opt/ros_hadoop/master
RUN bash -c "curl -s https://api.github.com/repos/autovia/ros_hadoop/releases/latest | egrep -io 'https://api.github.com/repos/autovia/ros_hadoop/tarball/[^\"]*' | xargs wget --quiet -O /opt/ros_hadoop/latest.tgz"
RUN bash -c "if [ ! -f /opt/ros_hadoop/master/dist/hadoop-3.0.2.tar.gz ] ; then wget --quiet -O /opt/ros_hadoop/master/dist/hadoop-3.0.2.tar.gz https://archive.apache.org/dist/hadoop/common/hadoop-3.0.2/hadoop-3.0.2.tar.gz ; fi"
RUN tar -xzf /opt/ros_hadoop/latest.tgz -C /opt/ros_hadoop/latest --strip-components=1 && rm /opt/ros_hadoop/latest.tgz
RUN tar -xzf /opt/ros_hadoop/master/dist/hadoop-3.0.2.tar.gz -C /opt/apache && rm /opt/ros_hadoop/master/dist/hadoop-3.0.2.tar.gz
RUN ln -s /opt/apache/hadoop-3.0.2 /opt/apache/hadoop
RUN bash -c "if [ ! -f /opt/ros_hadoop/latest/lib/rosbaginputformat.jar ] ; then ln -s /opt/ros_hadoop/master/lib/rosbaginputformat.jar /opt/ros_hadoop/latest/lib/rosbaginputformat.jar ; fi"
RUN printf "<configuration>\n\n<property>\n<name>fs.defaultFS</name>\n<value>hdfs://localhost:9000</value>\n</property>\n</configuration>" > /opt/apache/hadoop/etc/hadoop/core-site.xml && \
printf "<configuration>\n<property>\n<name>dfs.replication</name>\n<value>1</value>\n</property>\n</configuration>" > /opt/apache/hadoop/etc/hadoop/hdfs-site.xml && \
bash -c "/opt/apache/hadoop/bin/hdfs namenode -format 2>/dev/null" && \
printf "#! /bin/bash\n/opt/apache/hadoop/bin/hdfs --daemon stop datanode\n/opt/apache/hadoop/bin/hdfs --daemon stop namenode\n/opt/apache/hadoop/bin/hdfs --daemon start namenode\n/opt/apache/hadoop/bin/hdfs --daemon start datanode\nexec \"\$@\"\n" > /start_hadoop.sh && \
chmod a+x /start_hadoop.sh
RUN printf "#! /bin/bash\nset -e\nsource \"/opt/ros/$ROS_DISTRO/setup.bash\"\n/start_hadoop.sh\nexec \"\$@\"\n" > /ros_hadoop.sh && \
chmod a+x /ros_hadoop.sh
RUN bash -c "if [ ! -f /opt/ros_hadoop/master/dist/HMB_4.bag ] ; then wget --quiet -O /opt/ros_hadoop/master/dist/HMB_4.bag https://data.autovia.io/f/ros_hadoop/HMB_4.bag ; fi" && \
java -jar "$ROSIF_JAR" -f /opt/ros_hadoop/master/dist/HMB_4.bag
RUN bash -c "/start_hadoop.sh" && \
/opt/apache/hadoop/bin/hdfs dfsadmin -safemode wait && \
/opt/apache/hadoop/bin/hdfs dfsadmin -report && \
/opt/apache/hadoop/bin/hdfs dfs -mkdir /user && \
/opt/apache/hadoop/bin/hdfs dfs -mkdir /user/root && \
/opt/apache/hadoop/bin/hdfs dfs -put /opt/ros_hadoop/master/dist/HMB_4.bag && \
/opt/apache/hadoop/bin/hdfs --daemon stop datanode && \
/opt/apache/hadoop/bin/hdfs --daemon stop namenode
WORKDIR /opt/ros_hadoop/latest/doc/
ENTRYPOINT ["/ros_hadoop.sh"]
CMD ["jupyter", "notebook", "--allow-root", "--ip=0.0.0.0"]