-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
187 lines (162 loc) · 6.6 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
FROM osrf/ros:noetic-desktop-full
############################## SYSTEM PARAMETERS ##############################
# * Arguments
ARG USER=initial
ARG GROUP=initial
ARG UID=1000
ARG GID="${UID}"
ARG SHELL=/bin/bash
ARG HARDWARE=x86_64
ARG ENTRYPOINT_FILE=entrypint.sh
# * Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES all
# ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
# * Setup users and groups
RUN groupadd --gid "${GID}" "${GROUP}" \
&& useradd --gid "${GID}" --uid "${UID}" -ms "${SHELL}" "${USER}" \
&& mkdir -p /etc/sudoers.d \
&& echo "${USER}:x:${UID}:${UID}:${USER},,,:/home/${USER}:${SHELL}" >> /etc/passwd \
&& echo "${USER}:x:${UID}:" >> /etc/group \
&& echo "${USER} ALL=(ALL) NOPASSWD: ALL" > "/etc/sudoers.d/${USER}" \
&& chmod 0440 "/etc/sudoers.d/${USER}"
# * Replace apt urls
# ? Change to tku
RUN sed -i '[email protected]@ftp.tku.edu.tw@g' /etc/apt/sources.list
# ? Change to Taiwan
# RUN sed -i '[email protected]@tw.archive.ubuntu.com@g' /etc/apt/sources.list
# * Time zone
ENV TZ=Asia/Taipei
RUN ln -snf /usr/share/zoneinfo/"${TZ}" /etc/localtime && echo "${TZ}" > /etc/timezone
# * Copy custom configuration
# ? Requires docker version >= 17.09
COPY --chmod=0775 ./${ENTRYPOINT_FILE} /entrypoint.sh
COPY --chown="${USER}":"${GROUP}" --chmod=0775 config config
# ? docker version < 17.09
# COPY ./${ENTRYPOINT_FILE} /entrypoint.sh
# COPY config config
# RUN sudo chmod 0775 /entrypoint.sh && \
# sudo chown -R "${USER}":"${GROUP}" config \
# && sudo chmod -R 0775 config
############################### INSTALL #######################################
# * Install packages
RUN apt update \
&& apt install -y --no-install-recommends \
sudo \
git \
htop \
wget \
curl \
psmisc \
# * Shell
tmux \
terminator \
# * base tools
udev \
python3-pip \
python3-dev \
python3-setuptools \
python3-colcon-common-extensions \
dbus-x11 libglvnd0 libgl1 libglx0 libegl1 libxext6 libx11-6 libxtst6 libinih-dev\
software-properties-common \
lsb-release \
# * Work tools
&& apt clean \
&& rm -rf /var/lib/apt/lists/*
# gnome-terminal libcanberra-gtk-module libcanberra-gtk3-module \
# dbus-x11 libglvnd0 libgl1 libglx0 libegl1 libxext6 libx11-6 \
# display dep
# libnss3 libgbm1 libxshmfence1 libdrm2 libx11-xcb1 libxcb-*-dev
# ENV DEBIAN_FRONTEND=noninteractive
# RUN sudo add-apt-repository universe
# RUN sudo apt update
# RUN sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
# # RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
# RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
# RUN sudo apt update
# # RUN sudo apt install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" keyboard-configuration
# RUN sudo DEBIAN_FRONTEND=noninteractive apt install -y ros-galactic-desktop
# #ROS2 Cyclone DDS
# RUN sudo apt install -y ros-humble-rmw-cyclonedds-cpp
# #colcon depend
# RUN sudo apt install -y python3-colcon-common-extensions
# RUN sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
# RUN sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
# RUN apt update && apt install -y --no-install-recommends \
# # #Realsense SDK depend
# # librealsense2-dkms \
# # librealsense2-utils \
# # librealsense2-dev \
# # librealsense2-dbg \
# ros-humble-librealsense2* \
# ros-humble-diagnostic-updater \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists
RUN ./config/pip/pip_setup.sh
RUN sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
RUN sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
RUN apt update && apt install -y --no-install-recommends \
# #Realsense SDK depend
librealsense2-dkms \
librealsense2-utils \
librealsense2-dev \
librealsense2-dbg \
# ros-humble-librealsense2* \
# ros-humble-diagnostic-updater \
# ros-humble-moveit \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists
# #OMPL depend
# RUN apt update && apt install -y --no-install-recommends \
# lsb-release \
# g++ \
# cmake \
# pkg-config \
# libboost-serialization-dev \
# libboost-filesystem-dev \
# libboost-system-dev \
# libboost-program-options-dev \
# libboost-test-dev \
# libeigen3-dev \
# libode-dev wget \
# libyaml-cpp-dev \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists
# RUN sudo pip3 install -vU https://github.com/CastXML/pygccxml/archive/develop.zip pyplusplus
# RUN apt update && apt install -y --no-install-recommends \
# castxml \
# libboost-python-dev \
# libboost-numpy-dev \
# python3-numpy \
# pypy3 \
# python3-pyqt5.qtopengl \
# freeglut3-dev \
# libassimp-dev \
# python3-opengl \
# python3-flask \
# python3-celery \
# libccd-dev \
# libfcl-dev \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists
# RUN sudo pip3 install -vU PyOpenGL-accelerate
############################## USER CONFIG ####################################
# * Switch user to ${USER}
USER ${USER}
RUN ./config/shell/bash_setup.sh "${USER}" "${GROUP}" \
&& ./config/shell/terminator/terminator_setup.sh "${USER}" "${GROUP}" \
&& ./config/shell/tmux/tmux_setup.sh "${USER}" "${GROUP}" \
&& sudo rm -rf /config
RUN export CXX=g++
RUN export MAKEFLAGS="-j nproc"
RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
# RUN echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc
# * Switch workspace to ~/work
RUN sudo mkdir -p /home/"${USER}"/work
WORKDIR /home/"${USER}"/work
# * Make SSH available
EXPOSE 22
ENTRYPOINT [ "/entrypoint.sh", "terminator" ]
# ENTRYPOINT [ "/entrypoint.sh", "tmux" ]
# ENTRYPOINT [ "/entrypoint.sh", "bash" ]
# ENTRYPOINT [ "/entrypoint.sh" ]