Skip to content
Snippets Groups Projects
Unverified Commit 1cd1f9e0 authored by koalp's avatar koalp
Browse files

feat: add Dockerfiles for ros images

parent 638307dc
No related branches found
No related tags found
No related merge requests found
Docker images for ros course
\ No newline at end of file
Docker images for ros course
# Setup
Build the `registry.gitlab.clubelek.fr/formations/ros/docker-images/ros:user` images :
`make docker-user`
# Usage
Linux : `./run.sh registry.gitlab.clubelek.fr/formations/ros/docker-images/ros:user`
Windows : launch the vnc image `registry.gitlab.clubelek.fr/formations/ros/docker-images/ros:user-vnc`
makefile 0 → 100644
# TODO: universal image name from folder_name+dockerfile_name
registry_url=registry.gitlab.clubelek.fr/formations/ros/docker-images/
all: ros-base ros-desktop ros-graphic-acceleration ros-ide
.PHONY: ros-base ros-desktop ros-graphic-acceleration ros-user
ros-base:
docker build -t ${registry_url}ros:base -f ./ros-base/Dockerfile ./ros-base
ros-desktop: ros-base
docker build -t ${registry_url}ros:desktop -f ./ros-desktop/Dockerfile ./ros-desktop
ros-graphic-acceleration: ros-desktop
docker build -t ${registry_url}ros:graphic-acceleration -f ./ros-graphic-acceleration/Dockerfile ./ros-graphic-acceleration
ros-ide: ros-graphic-acceleration
docker build -t ${registry_url}ros:ide -f ./ros-ide/Dockerfile ./ros-ide
......@@ -25,7 +25,7 @@ RUN apt-get update && apt-get install -q -y \
# Install bare bones ROS Installation
RUN apt-get update && apt-get install -q -y \
ros-$ROS_VERSION_NAME-ros-base \
ros-$ROS_VERSION_NAME-ros-base python3-colcon-common-extensions \
&& rm -rf /var/lib/apt/lists/*
# Add source command to root user bashrc
......
FROM registry.gitlab.clubelek.fr/formations/ros/docker-images/ros:base
# Install desktop ROS Installation
RUN apt-get update && apt-get install -q -y \
ros-$ROS_VERSION_NAME-desktop \
&& rm -rf /var/lib/apt/lists/*
{
"file_format_version" : "1.0.0",
"ICD" : {
"library_path" : "libEGL_nvidia.so.0"
}
}
FROM registry.gitlab.clubelek.fr/formations/ros/docker-images/ros:desktop
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics,utility
# Required for non-glvnd setups.
ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
ca-certificates \
make \
automake \
autoconf \
libtool \
pkg-config \
python \
libxext-dev \
libx11-dev \
x11proto-gl-dev
WORKDIR /opt/libglvnd
RUN git clone --branch=0.1.1 https://github.com/NVIDIA/libglvnd.git . && \
./autogen.sh && \
./configure --prefix=/usr/local --libdir=/usr/local/lib/x86_64-linux-gnu && \
make -j"$(nproc)" install-strip && \
find /usr/local/lib/x86_64-linux-gnu -type f -name 'lib*.la' -delete
COPY 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 && \
echo '/usr/local/lib/i386-linux-gnu' >> /etc/ld.so.conf.d/glvnd.conf && \
ldconfig
ENV LD_LIBRARY_PATH /usr/local/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
RUN apt-get -y update && apt-get install -y zsh screen tree sudo ssh synaptic nano inetutils-ping git
# Additional development tools
RUN apt-get install -y x11-apps python-pip build-essential
FROM registry.gitlab.clubelek.fr/formations/ros/docker-images/ros:graphic-acceleration
WORKDIR /opt
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -q -y \
eclipse \
jupyter \
&& wget https://download.jetbrains.com/python/pycharm-professional-2019.2.4.tar.gz \
&& tar -xvf pycharm-professional-2019.2.4.tar.gz \
&& echo 'export PATH=/opt/pycharm-professional-2019.2.4/bin:${PATH}' >> /root/.bashrc \
&& rm -rf /var/lib/apt/lists/*
run.sh 0 → 100755
#!/usr/bin/env bash
# Check args
if [ "$#" -ne 3 ]; then
echo "usage: ./run.sh IMAGE_NAME CONTAINER_NAME WORKSPACE"
exit 1
fi
if [ ${3:0:1} == '/' ]; then
workspace_path=$3
else
workspace_path=`pwd`/$3
fi
# Get this script's path
pushd `dirname $0` > /dev/null
SCRIPTPATH=`pwd`
popd > /dev/null
set -e
XAUTH=/tmp/.docker.xauth
if [ ! -f $XAUTH ]
then
xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/')
if [ ! -z "$xauth_list" ]
then
echo $xauth_list | xauth -f $XAUTH nmerge -
else
touch $XAUTH
fi
chmod a+r $XAUTH
fi
# Run the container with shared X11
if [ -z DOCKER_NVIDIA ]; then
sudo docker run\
--privileged\
--rm\
--net=host\
-e SHELL\
--env="DISPLAY=$DISPLAY"\
--env="QT_X11_NO_MITSHM=1"\
-env="XAUTHORITY=$XAUTH"\
--volume="$XAUTH:$XAUTH"\
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--volume="${workspace_path}:${HOME}/workspace" \
-e DOCKER=1\
--name $2 \
--runtime=nvidia \
-it $1 bash
else
sudo docker run\
--privileged\
--rm\
--net=host\
-e SHELL\
--env="DISPLAY=$DISPLAY"\
--env="QT_X11_NO_MITSHM=1"\
-env="XAUTHORITY=$XAUTH"\
--volume="$XAUTH:$XAUTH"\
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--volume="${workspace_path}:${HOME}/workspace" \
-e DOCKER=1\
--name $2 \
-it $1 bash
fi
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment