-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.dev
85 lines (67 loc) · 3 KB
/
Dockerfile.dev
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
# syntax=docker/dockerfile:1
# Dockerfile for development
# Below RUN statements are broken up to take advantage of Docker layer cache.
# (OPTION) Use base Ubuntu 22.04 if a Nvidia GPU is unavailable.
# FROM ubuntu:22.04
FROM nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu22.04
ARG DEBIAN_FRONTEND=noninteractive
ENV LANG="C.UTF-8" LC_ALL="C.UTF-8"
RUN echo 'Etc/UTC' > /etc/timezone \
&& ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime
RUN apt-get update \
# Needed to curl and authorize ROS repository key.
&& apt-get install -y curl gnupg lsb-release software-properties-common \
&& apt-get install -y git \
# Enable universe repositories.
&& add-apt-repository universe
# Add VNC server & noVNC web app for debugging and control.
COPY ./.devcontainer/scripts/desktop-lite-debian.sh /tmp/scripts/desktop-lite-debian.sh
ENV DBUS_SESSION_BUS_ADDRESS="autolaunch:" \
VNC_RESOLUTION="1440x768x16" \
VNC_DPI="96" \
VNC_PORT="5901" \
NOVNC_PORT="6080" \
DISPLAY=":1"
RUN bash /tmp/scripts/desktop-lite-debian.sh root password
# Enable openCL support (OpenCV uses it for hardware acceleration).
RUN mkdir -p /etc/OpenCL/vendors && \
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
# Curl key to authorize ROS repository.
RUN 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 $(. /etc/os-release && echo $UBUNTU_CODENAME) main" > /etc/apt/sources.list.d/ros2.list
# ROS Humble's support window is till 2027 (correct as of 23 Nov 2022).
ARG ROS_DISTRO=humble
ENV ROS_DISTRO=$ROS_DISTRO
RUN apt-get update
RUN apt-get install -y \
ros-${ROS_DISTRO}-ros-base \
python3-rosdep \
python3-colcon-common-extensions \
python3-pip
# Set default version of Python to be the one ROS Humble uses.
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 10
# Initialize rosdep package manager.
RUN rosdep init && rosdep update
# RQT comes with useful debugging and control tools.
# RQT's plugin support allows for custom visualizations, tools or control panels.
RUN apt-get install -y ~nros-${ROS_DISTRO}-rqt*
# Curl key to authorize Docker repository.
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - 2>/dev/null \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
# Install Docker CLI tools (not including daemon).
RUN apt-get update \
&& apt-get install -y docker-ce-cli \
&& pip install docker-compose
# Needed for Dev Container lifecycle hooks to run.
COPY ./.devcontainer /tmp/.devcontainer
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ \
# VNC entrypoint
"/usr/local/share/desktop-init.sh" \
]
# Make /bin/sh launch bash instead.
ENV ENV=\$HOME/.shrc
RUN echo "exec bash" >> ~/.shrc
# Ensure RQT icons show up.
RUN mkdir ~/.icons && ln -s /usr/share/icons/Tango ~/.icons/hicolor