|
| 1 | +# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. |
| 2 | +# |
| 3 | +# NVIDIA CORPORATION and its licensors retain all intellectual property |
| 4 | +# and proprietary rights in and to this software, related documentation |
| 5 | +# and any modifications thereto. Any use, reproduction, disclosure or |
| 6 | +# distribution of this software and related documentation without an express |
| 7 | +# license agreement from NVIDIA CORPORATION is strictly prohibited. |
| 8 | +# |
| 9 | +# Docker file to build on x86_64 |
| 10 | +ARG BASE_IMAGE=nvidia/cuda:11.2.0-devel-ubuntu20.04 |
| 11 | +FROM ${BASE_IMAGE} |
| 12 | + |
| 13 | +# disable terminal interaction for apt |
| 14 | +ENV DEBIAN_FRONTEND=noninteractive |
| 15 | + |
| 16 | +# Fundamentals |
| 17 | +RUN apt-get update && apt-get install -y \ |
| 18 | + bash-completion \ |
| 19 | + build-essential \ |
| 20 | + clang-format \ |
| 21 | + cmake \ |
| 22 | + curl \ |
| 23 | + git \ |
| 24 | + gnupg2 \ |
| 25 | + locales \ |
| 26 | + lsb-release \ |
| 27 | + rsync \ |
| 28 | + software-properties-common \ |
| 29 | + wget \ |
| 30 | + vim \ |
| 31 | + mlocate \ |
| 32 | +&& rm -rf /var/lib/apt/lists/* |
| 33 | + |
| 34 | +# Python basics |
| 35 | +RUN apt-get update && apt-get install -y \ |
| 36 | + python3-flake8 \ |
| 37 | + python3-opencv \ |
| 38 | + python3-pip \ |
| 39 | + python3-pytest-cov \ |
| 40 | + python3-setuptools \ |
| 41 | +&& rm -rf /var/lib/apt/lists/* |
| 42 | + |
| 43 | +# Video utilities |
| 44 | +RUN apt-get update && apt-get install -y \ |
| 45 | + v4l-utils \ |
| 46 | + mesa-utils \ |
| 47 | + libcanberra-gtk-module \ |
| 48 | + libcanberra-gtk3-module \ |
| 49 | +&& rm -rf /var/lib/apt/lists/* |
| 50 | + |
| 51 | +# Core dev libraries |
| 52 | +RUN apt-get update && apt-get install -y \ |
| 53 | + libasio-dev \ |
| 54 | + libbullet-dev \ |
| 55 | + libtinyxml2-dev \ |
| 56 | + libcunit1-dev \ |
| 57 | +&& rm -rf /var/lib/apt/lists/* |
| 58 | + |
| 59 | +# Python3 (PIP) |
| 60 | +RUN python3 -m pip install -U \ |
| 61 | + argcomplete \ |
| 62 | + autopep8 \ |
| 63 | + flake8 \ |
| 64 | + flake8-blind-except \ |
| 65 | + flake8-builtins \ |
| 66 | + flake8-class-newline \ |
| 67 | + flake8-comprehensions \ |
| 68 | + flake8-deprecated \ |
| 69 | + flake8-docstrings \ |
| 70 | + flake8-import-order \ |
| 71 | + flake8-quotes \ |
| 72 | + pytest-repeat \ |
| 73 | + pytest-rerunfailures \ |
| 74 | + pytest \ |
| 75 | + pydocstyle \ |
| 76 | + scikit-learn |
| 77 | + |
| 78 | +# Install Git-LFS |
| 79 | +RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \ |
| 80 | + apt-get update && apt-get install -y \ |
| 81 | + git-lfs \ |
| 82 | +&& rm -rf /var/lib/apt/lists/* |
| 83 | + |
| 84 | +# Install VPI packages |
| 85 | +ARG HAS_GPU |
| 86 | +COPY vpi/*.deb /opt/install/ |
| 87 | +RUN if [ "$HAS_GPU" = "true" ]; then \ |
| 88 | + dpkg -i /opt/install/vpi-lib-1.1.11-cuda11-x86_64-linux.deb; \ |
| 89 | + dpkg -i /opt/install/vpi-dev-1.1.11-cuda11-x86_64-linux.deb; \ |
| 90 | + updatedb; \ |
| 91 | + fi |
| 92 | + |
| 93 | +# Setup ROS2 Foxy |
| 94 | +RUN locale-gen en_US en_US.UTF-8 |
| 95 | +RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 |
| 96 | +ENV LANG=en_US.UTF-8 |
| 97 | + |
| 98 | +RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - |
| 99 | +RUN sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list' |
| 100 | + |
| 101 | +RUN apt-get update && apt-get install -y \ |
| 102 | + python3-colcon-common-extensions \ |
| 103 | + python3-rosdep \ |
| 104 | + python3-vcstool \ |
| 105 | + ros-foxy-camera-calibration-parsers \ |
| 106 | + ros-foxy-camera-info-manager \ |
| 107 | + ros-foxy-desktop \ |
| 108 | + ros-foxy-launch-testing-ament-cmake \ |
| 109 | + ros-foxy-rqt* \ |
| 110 | + ros-foxy-turtlesim \ |
| 111 | + ros-foxy-v4l2-camera \ |
| 112 | + ros-foxy-realsense2-camera \ |
| 113 | +&& rm -rf /var/lib/apt/lists/* |
| 114 | + |
| 115 | +RUN rosdep init |
| 116 | + |
| 117 | +# Install Realsense |
| 118 | +RUN apt update \ |
| 119 | + && apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE \ |
| 120 | + || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE \ |
| 121 | + && add-apt-repository -y "deb https://librealsense.intel.com/Debian/apt-repo bionic main" -u \ |
| 122 | + && apt-get install -y librealsense2-utils librealsense2-dev |
| 123 | + |
| 124 | +# Restore using the default Foxy DDS middleware: FastRTPS |
| 125 | +ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp |
| 126 | + |
| 127 | +# Setup non-root admin user |
| 128 | +ARG USERNAME=admin |
| 129 | +ARG USER_UID=1000 |
| 130 | +ARG USER_GID=1001 |
| 131 | + |
| 132 | +# Create the 'admin' user |
| 133 | +RUN groupadd --gid $USER_GID $USERNAME \ |
| 134 | + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ |
| 135 | + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ |
| 136 | + && chmod 0440 /etc/sudoers.d/$USERNAME \ |
| 137 | + && adduser admin video && adduser admin sudo |
| 138 | + |
| 139 | +COPY scripts/workspace-entrypoint.sh /home/$USERNAME/workspace-entrypoint.sh |
| 140 | +RUN chmod +x /home/$USERNAME/workspace-entrypoint.sh |
| 141 | + |
0 commit comments