-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathDockerfile
executable file
·154 lines (126 loc) · 4.74 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# This Dockerfile is used to build an ROS + VNC + Tensorflow image based on Ubuntu 18.04
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
LABEL maintainer "Henry Huang"
MAINTAINER Henry Huang "https://github.com/henry2423"
ENV REFRESHED_AT 2018-10-29
# Install sudo
RUN apt-get update && \
apt-get install -y sudo \
xterm \
curl
# Configure user
ARG user=ros
ARG passwd=ros
ARG uid=1000
ARG gid=1000
ENV USER=$user
ENV PASSWD=$passwd
ENV UID=$uid
ENV GID=$gid
RUN groupadd $USER && \
useradd --create-home --no-log-init -g $USER $USER && \
usermod -aG sudo $USER && \
echo "$PASSWD:$PASSWD" | chpasswd && \
chsh -s /bin/bash $USER && \
# Replace 1000 with your user/group id
usermod --uid $UID $USER && \
groupmod --gid $GID $USER
### Install VScode
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg && \
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ && \
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
RUN sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y code
### VNC Installation
LABEL io.k8s.description="VNC Container with ROS with Xfce window manager" \
io.k8s.display-name="VNC Container with ROS based on Ubuntu" \
io.openshift.expose-services="6901:http,5901:xvnc,6006:tnesorboard" \
io.openshift.tags="vnc, ros, gazebo, tensorflow, ubuntu, xfce" \
io.openshift.non-scalable=true
## Connection ports for controlling the UI:
# VNC port:5901
# noVNC webport, connect via http://IP:6901/?password=vncpassword
ENV DISPLAY=:1 \
VNC_PORT=5901 \
NO_VNC_PORT=6901
EXPOSE $VNC_PORT $NO_VNC_PORT
## Envrionment config
ENV VNCPASSWD=vncpassword
ENV HOME=/home/$USER \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/home/$USER/install \
NO_VNC_HOME=/home/$USER/noVNC \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1920x1080 \
VNC_PW=$VNCPASSWD \
VNC_VIEW_ONLY=false
WORKDIR $HOME
## Add all install scripts for further steps
ADD ./src/common/install/ $INST_SCRIPTS/
ADD ./src/ubuntu/install/ $INST_SCRIPTS/
RUN find $INST_SCRIPTS -name '*.sh' -exec chmod a+x {} +
## Install some common tools
RUN $INST_SCRIPTS/tools.sh
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
## Install xvnc-server & noVNC - HTML5 based VNC viewer
RUN $INST_SCRIPTS/tigervnc.sh
RUN $INST_SCRIPTS/no_vnc.sh
## Install firefox and chrome browser
RUN $INST_SCRIPTS/firefox.sh
RUN $INST_SCRIPTS/chrome.sh
## Install xfce UI
RUN $INST_SCRIPTS/xfce_ui.sh
ADD ./src/common/xfce/ $HOME/
## configure startup
RUN $INST_SCRIPTS/libnss_wrapper.sh
ADD ./src/common/scripts $STARTUPDIR
RUN $INST_SCRIPTS/set_user_permission.sh $STARTUPDIR $HOME
### ROS and Gazebo Installation
# Install other utilities
RUN apt-get update && \
apt-get install -y vim \
tmux \
git
# Install ROS
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list' && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 && \
curl http://repo.ros2.org/repos.key | sudo apt-key add - && \
apt-get update && apt-get install -y ros-melodic-desktop && \
apt-get install -y python-rosinstall
# Install Gazebo
RUN sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' && \
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - && \
apt-get update && \
apt-get install -y gazebo9 libgazebo9-dev && \
apt-get install -y ros-melodic-gazebo-ros-pkgs ros-melodic-gazebo-ros-control
#install missing rosdep
RUN apt-get install python-rosdep
# Setup ROS
#USER $USER
RUN rosdep init
RUN rosdep fix-permissions
USER $USER
RUN rosdep update
RUN echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
RUN /bin/bash -c "source ~/.bashrc"
###Tensorflow Installation
# Install pip
USER root
RUN apt-get install -y wget python-pip python-dev libgtk2.0-0 unzip libblas-dev liblapack-dev libhdf5-dev && \
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python get-pip.py
# prepare default python 2.7 environment
USER root
RUN pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.11.0-cp27-none-linux_x86_64.whl && \
pip install keras==2.2.4 matplotlib pandas scipy h5py testresources scikit-learn
# Expose Tensorboard
EXPOSE 6006
# Expose Jupyter
EXPOSE 8888
### Switch to root user to install additional software
USER $USER
ENTRYPOINT ["/dockerstartup/vnc_startup.sh"]
CMD ["--wait"]