-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker: Add truly generic docker support
Unify docker support with a new (and more generic) set of docker files. Two main images are created: - Base image containing an Ubuntu installation with all dependencies - Build image containing a pre-built Autoware When Cuda support is enabled, there is a further Base+Cuda support image. These Dockerfiles can be used for both AArch64 and x86_64 images. Co-authored-by: Filipe Rinaldi <filipe.rinaldi@arm.com>
- Loading branch information
1 parent
8e0485f
commit f65716b
Showing
16 changed files
with
562 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.git* | ||
ros/build* | ||
ros/devel* | ||
ros/install* | ||
ros/log* | ||
ros/coverage_* |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ARG FROM_ARG | ||
ARG ROS_DISTRO | ||
FROM ${FROM_ARG} | ||
|
||
ENV USERNAME autoware | ||
|
||
# Build Autoware | ||
COPY --chown=autoware ./ /home/$USERNAME/Autoware | ||
RUN su -c "bash -c 'source /opt/ros/$ROS_DISTRO/setup.bash; \ | ||
cd /home/$USERNAME/Autoware/ros/src; \ | ||
catkin_init_workspace; \ | ||
cd ../; \ | ||
./catkin_make_release'" $USERNAME | ||
RUN echo "source /home/$USERNAME/Autoware/ros/devel/setup.bash" >> \ | ||
/home/$USERNAME/.bashrc | ||
|
||
COPY ./docker/generic/entrypoint.sh /tmp | ||
ENTRYPOINT ["/tmp/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# | ||
# Install ROS packages used by Autoware. | ||
# | ||
ARG ROS_DISTRO | ||
FROM ros:$ROS_DISTRO | ||
|
||
# | ||
# Install tools and libraries required by Autoware | ||
# | ||
RUN apt-get update && apt-get install -y \ | ||
cmake-curses-gui \ | ||
cmake-qt-gui \ | ||
dbus-x11 \ | ||
dmz-cursor-theme \ | ||
fonts-dejavu \ | ||
gconf2 \ | ||
gnome-terminal \ | ||
gstreamer0.10-plugins-good \ | ||
language-pack-en \ | ||
libarmadillo-dev \ | ||
libcanberra-gtk-module \ | ||
libcanberra-gtk3-0 \ | ||
libcanberra-gtk3-module \ | ||
libdbus-glib-1-2 \ | ||
libgflags-dev \ | ||
libglew-dev \ | ||
libgoogle-glog-dev \ | ||
libgoogle-perftools-dev \ | ||
libgsl0-dev \ | ||
libmosquitto-dev \ | ||
libopencv-dev \ | ||
libopenni2-dev \ | ||
libpcap-dev \ | ||
libssh2-1-dev \ | ||
locales \ | ||
pulseaudio \ | ||
python-flask \ | ||
python-requests \ | ||
python3-colcon-common-extensions \ | ||
python3-pip \ | ||
python3-setuptools \ | ||
sudo \ | ||
tmux \ | ||
v4l-utils \ | ||
vim \ | ||
wget && \ | ||
pip3 install -U setuptools && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# | ||
# Configure environmet | ||
# | ||
|
||
RUN update-locale LANG=en_US.UTF-8 LC_MESSAGES=POSIX | ||
|
||
# Add user | ||
ENV USERNAME autoware | ||
ARG USER_ID=1000 | ||
ARG GROUP_ID=15214 | ||
ENV PULSE_SERVER /run/pulse/native | ||
|
||
RUN groupadd --gid $GROUP_ID $USERNAME && \ | ||
useradd --gid $GROUP_ID -m $USERNAME && \ | ||
echo "$USERNAME:$USERNAME" | chpasswd && \ | ||
usermod --shell /bin/bash $USERNAME && \ | ||
usermod -aG sudo $USERNAME && \ | ||
usermod --uid $USER_ID $USERNAME && \ | ||
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME && \ | ||
chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
||
# Startup scripts | ||
ENV LANG="en_US.UTF-8" | ||
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /etc/profile.d/ros.sh && \ | ||
# Fix for QT and X server errors | ||
echo "export QT_X11_NO_MITSHM=1" >> /etc/profile.d/autoware.sh && \ | ||
# Set defaut language | ||
echo "export LANG=\"en_US.UTF-8\"" >> /etc/profile.d/autoware.sh | ||
|
||
# | ||
# Scan Autoware packages to install dependencies | ||
# | ||
COPY ./ /tmp/Autoware | ||
RUN apt-get update && \ | ||
apt-get install -y ros-$ROS_DISTRO-desktop-full && \ | ||
rosdep install -y --from-paths /tmp/Autoware/ros/src --ignore-src && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
rm -rf /tmp/Autoware # Removed for clean environment | ||
|
||
RUN su -c "rosdep update" autoware | ||
|
||
# Configure terminal colors | ||
RUN su -c "gconftool-2 --set \"/apps/gnome-terminal/profiles/Default/use_theme_background\" --type bool false" autoware && \ | ||
su -c "gconftool-2 --set \"/apps/gnome-terminal/profiles/Default/use_theme_colors\" --type bool false" autoware && \ | ||
su -c "gconftool-2 --set \"/apps/gnome-terminal/profiles/Default/background_color\" --type string \"#000000\"" autoware | ||
|
||
COPY ./docker/generic/entrypoint.sh /tmp | ||
ENTRYPOINT ["/tmp/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
ARG FROM_ARG | ||
FROM ${FROM_ARG} | ||
USER root | ||
|
||
|
||
# From nvidia cuda 9.0 base: https://gitlab.com/nvidia/cuda/tree/ubuntu16.04/9.0/base/Dockerfile | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates apt-transport-https gnupg-curl && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
NVIDIA_GPGKEY_SUM=d1be581509378368edeec8c1eb2958702feedf3bc3d17011adbf24efacce4ab5 && \ | ||
NVIDIA_GPGKEY_FPR=ae09fe4bbd223a84b2ccfce3f60f4b3d7fa2af80 && \ | ||
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub && \ | ||
apt-key adv --export --no-emit-version -a $NVIDIA_GPGKEY_FPR | tail -n +5 > cudasign.pub && \ | ||
echo "$NVIDIA_GPGKEY_SUM cudasign.pub" | sha256sum -c --strict - && rm cudasign.pub && \ | ||
echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/cuda.list && \ | ||
echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list | ||
|
||
ENV CUDA_VERSION 9.0.176 | ||
|
||
ENV CUDA_PKG_VERSION 9-0=$CUDA_VERSION-1 | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
cuda-cudart-$CUDA_PKG_VERSION && \ | ||
ln -s cuda-9.0 /usr/local/cuda && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \ | ||
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf | ||
|
||
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} | ||
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64 | ||
|
||
# nvidia-container-runtime | ||
ENV NVIDIA_VISIBLE_DEVICES all | ||
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility | ||
ENV NVIDIA_REQUIRE_CUDA "cuda>=9.0" | ||
|
||
|
||
# From nvidia cuda 9.0 runtime: https://gitlab.com/nvidia/cuda/blob/ubuntu16.04/9.0/runtime/Dockerfile | ||
|
||
ENV NCCL_VERSION 2.3.7 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
cuda-libraries-$CUDA_PKG_VERSION \ | ||
cuda-cublas-9-0=9.0.176.4-1 \ | ||
libnccl2=$NCCL_VERSION-1+cuda9.0 && \ | ||
apt-mark hold libnccl2 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# From nvidia cuda 9.0 devel: https://gitlab.com/nvidia/cuda/blob/ubuntu16.04/9.0/devel/Dockerfile | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
cuda-libraries-dev-$CUDA_PKG_VERSION \ | ||
cuda-nvml-dev-$CUDA_PKG_VERSION \ | ||
cuda-minimal-build-$CUDA_PKG_VERSION \ | ||
cuda-command-line-tools-$CUDA_PKG_VERSION \ | ||
cuda-core-9-0=9.0.176.3-1 \ | ||
cuda-cublas-dev-9-0=9.0.176.4-1 \ | ||
libnccl-dev=$NCCL_VERSION-1+cuda9.0 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
ENV LIBRARY_PATH /usr/local/cuda/lib64/stubs | ||
|
||
# Support for Nvidia docker v2 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
pkg-config \ | ||
libxau-dev \ | ||
libxdmcp-dev \ | ||
libxcb1-dev \ | ||
libxext-dev \ | ||
libx11-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
COPY --from=nvidia/opengl:1.0-glvnd-runtime-ubuntu16.04 \ | ||
/usr/local/lib/x86_64-linux-gnu \ | ||
/usr/local/lib/x86_64-linux-gnu | ||
COPY --from=nvidia/opengl:1.0-glvnd-runtime-ubuntu16.04 \ | ||
/usr/local/share/glvnd/egl_vendor.d/10_nvidia.json \ | ||
/usr/local/share/glvnd/egl_vendor.d/10_nvidia.json | ||
RUN echo '/usr/local/lib/x86_64-linux-gnu' >> /etc/ld.so.conf.d/glvnd.conf && \ | ||
ldconfig && \ | ||
echo '/usr/local/$LIB/libGL.so.1' >> /etc/ld.so.preload && \ | ||
echo '/usr/local/$LIB/libEGL.so.1' >> /etc/ld.so.preload | ||
RUN apt update | ||
# nvidia-container-runtime | ||
ENV NVIDIA_VISIBLE_DEVICES \ | ||
${NVIDIA_VISIBLE_DEVICES:-all} | ||
ENV NVIDIA_DRIVER_CAPABILITIES \ | ||
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics | ||
|
||
ENTRYPOINT ["/tmp/entrypoint.sh"] |
Oops, something went wrong.