Select Git revision
devenv.Dockerfile
-
Montaño Sarria, Andres Felipe authoredMontaño Sarria, Andres Felipe authored
devenv.Dockerfile 6.05 KiB
# ***********************************************************
# * DEVENV Base Image for ROS *
# ***********************************************************
ARG ROS_DISTRO
FROM osrf/ros:${ROS_DISTRO}-desktop-full as devenv
ENV ROS_DISTRO "${ROS_DISTRO}"
ARG EXT_SHELL=bash
ENV EXT_SHELL "${EXT_SHELL}"
ENV SHELL "/bin/${EXT_SHELL}"
RUN echo "Building devenv for ROS" $ROS_DISTRO "with shell" $EXT_SHELL
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# Import the key in order to be able to use the packages from the repository
# NOV - 2023
# RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA
# Setup environment
RUN apt-get update && apt-get install -y apt-utils
# Setup locales
RUN apt-get install -y \
locales \
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Configure apt and install base packages
RUN apt-get update && \
apt-get -y install --no-install-recommends \
apt-transport-https \
bat \
ca-certificates \
checkinstall \
clang-format clang-tidy clang-tools clang clangd\
cmake-curses-gui \
curl \
dbus-x11 \
dialog 2>&1 \
direnv \
gawk \
gdb \
git \
git-core \
git-lfs \
gnupg-agent \
fzf \
iputils-ping \
less \
nano \
net-tools \
openssh-client \
python3-pip \
ripgrep \
software-properties-common \
trash-cli \
valgrind \
wget \
xterm
# Install zsh if requested
RUN if [ "$EXT_SHELL" = "zsh" ]; \
then \
apt-get -y install zsh; \
fi
# Configure system to look for debian packages in the Tecnalia's artifactory repository
COPY auth.conf /etc/apt/auth.conf.d/tecnalia.conf
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
# Configure rosdep
RUN sh -c "echo 'yaml https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/rosdistro/rosdep_tecnalia.yaml' \
>> /etc/ros/rosdep/sources.list.d/20-default.list"
# Copy the requirements.txt file into the container
WORKDIR /tmp/dependencies/
COPY /distro_dependencies/* ./
# Install the packages listed in ${ROS_DISTRO}_requirements.txt
RUN if [ -f "${ROS_DISTRO}_requirements.txt" ]; \
then \
apt-get update && \
# Install apt-get packages
awk '/^# APT-GET PACKAGES/,/^# PIP PACKAGES/' ${ROS_DISTRO}_requirements.txt | grep -v '^#' | xargs apt-get install -y && \
# Install pip packages
# workaround for ROS jazzy
export PIP_BREAK_SYSTEM_PACKAGES=1 && \
awk '/^# PIP PACKAGES/,0' ${ROS_DISTRO}_requirements.txt | grep -v '^#' | xargs -r -n1 pip install -U ;\
apt-get clean; \
fi
# Install extra libs from .deb files
WORKDIR /tmp/srcs/
COPY /extra_libs/* ./
# Install the packages listed in common_libs.txt
RUN if [ -f "common_libs.txt" ]; \
then \
# Download .deb files from common_libs.txt using wget
grep -v '^#' common_libs.txt | xargs wget \
# Install .deb files
&& dpkg -i *.deb; \
fi
# Install notify-osd
RUN apt-get --reinstall install -y libnotify-bin notify-osd
RUN rm -rf *
# Update base image
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y autoremove \
&& apt-get -y autoclean
# Copy entrypoint
COPY ./ros_entrypoint.sh /
RUN chmod a+x /ros_entrypoint.sh
# Set running in docker for zsh powerlevel10k
ENV RUNNING_IN_DOCKER true
# Define entrypoint and command
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD $EXT_SHELL
# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=
# ***********************************************************
# * WORKSPACE EXTENDED *
# ***********************************************************
# Use devenv as base image
FROM devenv as workspace-extended
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND noninteractive
# Install extra packages ws_dependencies
ARG PACKAGES=none
WORKDIR /tmp/dependencies/
COPY /ws_dependencies/* ./
RUN if [ "$PACKAGES" != "none" ]; \
then \
if [ -f "${PACKAGES}" ]; \
then \
# Install apt-get packages
apt-get update && \
awk '/^# APT-GET PACKAGES/,/^# PIP PACKAGES/' ${PACKAGES} | grep -v '^#' | xargs apt-get install -y && \
# Install pip packages
export PIP_BREAK_SYSTEM_PACKAGES=1 && \
awk '/^# PIP PACKAGES/,0' ${PACKAGES} | grep -v '^#' | xargs -r -n1 pip install -U ;\
apt-get clean; \
fi \
fi
# Install open3d from source workaround in jazzy
RUN if [ "$ROS_DISTRO" = "jazzy" ]; \
then \
PIP_BREAK_SYSTEM_PACKAGES=1 pip install -U -f https://www.open3d.org/docs/latest/getting_started.html --only-binary open3d open3d; \
fi
# Install Peak driver
ARG PEAK_DRIVER=none
RUN if [ "$PEAK_DRIVER" = "install" ]; \
then \
apt-get update && apt-get install -y udev libpopt-dev linux-headers-$(uname -r) \
&& wget https://www.peak-system.com/fileadmin/media/linux/files/peak-linux-driver-8.18.0.tar.gz \
# && wget https://www.peak-system.com/quick/PEAK-Linux-Driver -O peak-linux-driver.tar.gz \
&& wget https://www.peak-system.com/quick/BasicLinux -O PCAN-Basic_Linux.tar.gz \
&& tar -xvf peak-linux-driver-8.18.0.tar.gz \
&& cd peak-linux-driver-8.18.0 \
&& make clean && make install || echo 'make failed but move forward'\
&& cd .. \
&& tar -xvf PCAN-Basic_Linux.tar.gz \
&& cd PCAN-Basic_Linux-4.9.0.7/libpcanbasic \
&& make clean && make install || echo 'make failed but move forward';\
fi
RUN rm -rf *
# Update this date to re-run the image final update
LABEL image.date=06-11-2024
# Update final image
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y autoremove \
&& apt-get -y autoclean
# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=
# Define entrypoint and command
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD $EXT_SHELL