Skip to content
Snippets Groups Projects
Select Git revision
  • e0ae0462420b2b9a7ca3ebaaa896ca24be5bd93a
  • main default
2 results

devenv.Dockerfile

Blame
  • devenv.Dockerfile 4.23 KiB
    ARG ROS_DISTRO
    
    FROM osrf/ros:${ROS_DISTRO}-desktop-full
    RUN echo "Building devenv for ROS" $ROS_DISTRO
    
    # Avoid warnings by switching to noninteractive
    ENV DEBIAN_FRONTEND=noninteractive
    
    # Setup environment
    RUN apt-get update && apt-get install -y apt-utils
    
    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 ubuntu-base packages
    RUN apt-get update && \
        apt-get -y install --no-install-recommends \
        apt-transport-https \
        ca-certificates \
        curl \
        dbus-x11 \
        gnupg-agent \
        software-properties-common \
        dialog 2>&1 \
        checkinstall \
        # clang
        clang-format clang-tidy clang-tools clang \
        libc++-dev libc++1 libc++abi-dev \
        libc++abi1 libclang-dev libclang1  \
        libomp-dev libomp5 lld lldb \
        llvm-dev llvm-runtime llvm \
        # ccmake
        cmake-curses-gui \
        direnv \
        gdb \
        git \
        git-lfs \
        less \
        nano \
        net-tools \
        openssh-client \
        trash-cli \
        valgrind \
        xterm \
        wget \
        zsh
    
    # ZSH tools based on ubuntu version
    WORKDIR /tmp/srcs/
    COPY /extra_libs/* ./
    
    RUN if [ "${ROS_DISTRO}" = "melodic"  ]; \
        then \
            dpkg -i *.deb; \
        else \
            dpkg -i bat*.deb; \
            dpkg -i lsd*.deb; \
            dpkg -i ripgrep*.deb; \
        fi
    
    RUN rm -rf *
    
    RUN apt-get --reinstall install -y libnotify-bin notify-osd
    
    # Configure system to look for debian packages in the Artifactory repository
    COPY auth.conf /etc/apt/auth.conf.d/tecnalia.conf
    
    # Import the key in order to be able to use the packages from the repository
    RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7E72C5B4111A50084C63C9489E7A9B1D990CF897
    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"
    
    # Install docker-ce
    # RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
    # RUN add-apt-repository \
    #     "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    # RUN apt-get update && apt-get -y install \
    #     docker-ce \
    #     docker-ce-cli \
    #     containerd.io \
    #     docker-compose-plugin
    
    # Install python - python3 packages based on ubuntu version
    RUN if [ "${ROS_DISTRO}" = "melodic"  ]; \
        then \
            apt-get update && \
            apt-get -y install \
            ipython \
            python-catkin-tools \
            python-pip \
            python-osrf-pycommon\
            python-vcstool; \
        else\
            apt-get update && \
            apt-get -y install \
            ipython3 \
            python-is-python3 \
            python3-click \
            python3-numpy \
            python3-osrf-pycommon \
            python3-vcstool \
            python3-pip \
            # clang
            clangd liblldb-dev libllvm-ocaml-dev python3-clang; \
        fi
    
    # Install ROS 1 tools
    RUN if [ "${ROS_DISTRO}" != "humble"  ]; \
        then \
            apt-get update && \
            apt-get -y install \
            ros-${ROS_DISTRO}-catkin \
            ros-${ROS_DISTRO}-plotjuggler \
            ros-${ROS_DISTRO}-plotjuggler-ros \
            ros-${ROS_DISTRO}-rosmon \
            ros-${ROS_DISTRO}-rqt-controller-manager \
            ros-${ROS_DISTRO}-rqt-joint-trajectory-controller; \
        fi
    
    # Copy the requirements.txt file into the container
    WORKDIR /tmp/dependencies/
    COPY /ws_dependencies/* ./
    
    # Install the packages listed in ${ROS_DISTRO}_requirements.txt
    RUN if [ -f "${ROS_DISTRO}_requirements.txt" ]; \
        then \
            apt-get update && \
            apt-get install -y $(cat ${ROS_DISTRO}_requirements.txt);\
        fi
    
    RUN rm -rf *
    
    # Update this date to re-run the image final update
    LABEL image.date=17-10-2023
    
    # Update final image
    RUN apt-get update \
        && apt-get -y upgrade \
        && apt-get -y autoremove \
        && apt-get -y autoclean
    
    # Set entrypoint
    COPY ./ros_entrypoint.sh /
    RUN chmod a+x /ros_entrypoint.sh
    
    ENTRYPOINT ["/ros_entrypoint.sh"]
    CMD ["zsh"]
    ENV ROS_DISTRO "${ROS_DISTRO}"
    ENV SHELL /usr/bin/zsh
    ENV RUNNING_IN_DOCKER true
    
    # Switch back to dialog for any ad-hoc use of apt-get
    ENV DEBIAN_FRONTEND=