Skip to content
Snippets Groups Projects
Commit eb5483d4 authored by Montaño Sarria, Andres Felipe's avatar Montaño Sarria, Andres Felipe
Browse files

Update Dorcker file to support image base and extended

parent 09b7ece7
Branches
No related tags found
No related merge requests found
# ***********************************************************
# * DEVENV Base Image for ROS *
# ***********************************************************
ARG ROS_DISTRO ARG ROS_DISTRO
FROM osrf/ros:${ROS_DISTRO}-desktop-full FROM osrf/ros:${ROS_DISTRO}-desktop-full as devenv
ENV ROS_DISTRO "${ROS_DISTRO}" ENV ROS_DISTRO "${ROS_DISTRO}"
ARG EXT_SHELL=bash ARG EXT_SHELL=bash
ENV EXT_SHELL "${EXT_SHELL}"
ENV SHELL="/bin/${SHELL}"
RUN echo "Building devenv for ROS" $ROS_DISTRO "with shell" $EXT_SHELL RUN echo "Building devenv for ROS" $ROS_DISTRO "with shell" $EXT_SHELL
# Avoid warnings by switching to noninteractive # Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Import the key in order to be able to use the packages from the repository # 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
# NOV - 2023 # NOV - 2023
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA # RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA
# Setup environment # Setup environment
RUN apt-get update && apt-get install -y apt-utils RUN apt-get update && apt-get install -y apt-utils
# Setup locales
RUN apt-get install -y \ RUN apt-get install -y \
locales \ locales \
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen en_US.UTF-8 && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen en_US.UTF-8
...@@ -70,12 +76,6 @@ RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt ...@@ -70,12 +76,6 @@ RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt
RUN sh -c "echo 'yaml https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/rosdistro/rosdep_tecnalia.yaml' \ 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" >> /etc/ros/rosdep/sources.list.d/20-default.list"
# Create a virtual environment
# RUN apt-get install -y python3-venv
# ENV VIRTUAL_ENV=/opt/venv
# RUN python3 -m venv $VIRTUAL_ENV
# ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Copy the requirements.txt file into the container # Copy the requirements.txt file into the container
WORKDIR /tmp/dependencies/ WORKDIR /tmp/dependencies/
COPY /distro_dependencies/* ./ COPY /distro_dependencies/* ./
...@@ -87,17 +87,67 @@ RUN if [ -f "${ROS_DISTRO}_requirements.txt" ]; \ ...@@ -87,17 +87,67 @@ RUN if [ -f "${ROS_DISTRO}_requirements.txt" ]; \
# Install apt-get packages # Install apt-get packages
awk '/^# APT-GET PACKAGES/,/^# PIP PACKAGES/' ${ROS_DISTRO}_requirements.txt | grep -v '^#' | xargs apt-get install -y && \ awk '/^# APT-GET PACKAGES/,/^# PIP PACKAGES/' ${ROS_DISTRO}_requirements.txt | grep -v '^#' | xargs apt-get install -y && \
# Install pip packages # Install pip packages
# workaround for ROS jazzy
export PIP_BREAK_SYSTEM_PACKAGES=1 && \ export PIP_BREAK_SYSTEM_PACKAGES=1 && \
awk '/^# PIP PACKAGES/,0' ${ROS_DISTRO}_requirements.txt | grep -v '^#' | xargs -r -n1 pip install -U ;\ awk '/^# PIP PACKAGES/,0' ${ROS_DISTRO}_requirements.txt | grep -v '^#' | xargs -r -n1 pip install -U ;\
apt-get clean; \ apt-get clean; \
fi 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 * 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
# Set extra environment variables for ROS2
ENV ROS_LOCALHOST_ONLY=1
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# 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 # Install extra packages ws_dependencies
ARG PACKAGES=none ARG PACKAGES=none
WORKDIR /tmp/dependencies/
COPY /ws_dependencies/* ./ COPY /ws_dependencies/* ./
RUN echo $PACKAGES
RUN if [ "$PACKAGES" != "none" ]; \ RUN if [ "$PACKAGES" != "none" ]; \
then \ then \
if [ -f "${PACKAGES}" ]; \ if [ -f "${PACKAGES}" ]; \
...@@ -112,28 +162,14 @@ RUN if [ "$PACKAGES" != "none" ]; \ ...@@ -112,28 +162,14 @@ RUN if [ "$PACKAGES" != "none" ]; \
fi \ fi \
fi fi
RUN rm -rf * # Install open3d from source workaround in jazzy
# Install extra libs from .deb files
WORKDIR /tmp/srcs/
COPY /extra_libs/* ./
# Enviroment tools based on ubuntu version
RUN if [ -f "common_libs.txt" ]; \
then \
grep -v '^#' common_libs.txt | xargs wget \
&& dpkg -i *.deb; \
fi
RUN apt-get --reinstall install -y libnotify-bin notify-osd
# RUN PIP_BREAK_SYSTEM_PACKAGES=1 pip install git+https://github.com/isl-org/Open3D.git
RUN if [ "$ROS_DISTRO" = "jazzy" ]; \ RUN if [ "$ROS_DISTRO" = "jazzy" ]; \
then \ then \
PIP_BREAK_SYSTEM_PACKAGES=1 pip install -U -f https://www.open3d.org/docs/latest/getting_started.html --only-binary open3d open3d; \ PIP_BREAK_SYSTEM_PACKAGES=1 pip install -U -f https://www.open3d.org/docs/latest/getting_started.html --only-binary open3d open3d; \
fi fi
ARG PEAK_DRIVER=install # Install Peak driver
ARG PEAK_DRIVER=none
RUN if [ "$PEAK_DRIVER" = "install" ]; \ RUN if [ "$PEAK_DRIVER" = "install" ]; \
then \ then \
apt-get update && apt-get install -y udev libpopt-dev linux-headers-$(uname -r) \ apt-get update && apt-get install -y udev libpopt-dev linux-headers-$(uname -r) \
...@@ -152,7 +188,7 @@ RUN if [ "$PEAK_DRIVER" = "install" ]; \ ...@@ -152,7 +188,7 @@ RUN if [ "$PEAK_DRIVER" = "install" ]; \
RUN rm -rf * RUN rm -rf *
# Update this date to re-run the image final update # Update this date to re-run the image final update
LABEL image.date=30-10-2024 LABEL image.date=06-11-2024
# Update final image # Update final image
RUN apt-get update \ RUN apt-get update \
...@@ -160,41 +196,5 @@ RUN apt-get update \ ...@@ -160,41 +196,5 @@ RUN apt-get update \
&& apt-get -y autoremove \ && apt-get -y autoremove \
&& apt-get -y autoclean && apt-get -y autoclean
# Set entrypoint
COPY ./ros_entrypoint.sh /
RUN chmod a+x /ros_entrypoint.sh
ENV EXT_SHELL "${EXT_SHELL}"
ENV RUNNING_IN_DOCKER true
# Switch back to dialog for any ad-hoc use of apt-get # Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND= ENV DEBIAN_FRONTEND=
# Enable localhost only ROS2
ENV ROS_LOCALHOST_ONLY=1
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ARG SHELL=/bin/bash
ENV SHELL="${SHELL}"
# ARG USERNAME=danil
# ARG USER_UID=1000
# ARG USER_GID=$USER_UID
# # Delete user if it exists in container (e.g Ubuntu Noble: ubuntu)
# RUN if id -u $USER_UID ; then userdel `id -un $USER_UID` ; fi
# # Create the user
# RUN groupadd --gid $USER_GID $USERNAME \
# && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
# #
# # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
# && apt-get update \
# && apt-get install -y sudo \
# && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
# && chmod 0440 /etc/sudoers.d/$USERNAME
# USER ${USERNAME}
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD $EXT_SHELL
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment