diff --git a/docker/Dockerfile.ros1 b/docker/Dockerfile.ros1 index 63bf6aa..26c8d5e 100644 --- a/docker/Dockerfile.ros1 +++ b/docker/Dockerfile.ros1 @@ -15,7 +15,7 @@ ARG ROS_ARCHITECTURE_VERSION=latest -FROM ronaldsonbellande/bellande_robotic_environment:latest +FROM ronaldsonbellande/bellande_robotic_environment_ros1:latest SHELL [ "/bin/bash" , "-c" ] ENV DEBIAN_FRONTEND noninteractive @@ -25,41 +25,31 @@ ARG ROS_ARCHITECTURE_VERSION_GIT_BRANCH=main ARG ROS_ARCHITECTURE_VERSION_GIT_COMMIT=HEAD ENV ROS_VERSION=noetic -ENV CATKIN_WS=/root/catkin_ws +ENV CATKIN_WS=/opt/ros/overlay_ws LABEL maintainer=ronaldsonbellande@gmail.com LABEL author=ronaldsonbellande@gmail.com LABEL ROS_architecture_github_branchtag=${ROS_ARCHITECTURE_VERSION_GIT_BRANCH} LABEL ROS_architecture_github_commit=${ROS_ARCHITECTURE_VERSION_GIT_COMMIT} -# Create local catkin workspace +# Create local catkin workspace and # copy every package RUN mkdir -p $CATKIN_WS/src - -# Copy Every Package -COPY ../ ${CATKIN_WS}/src - -# Set the working directory for Catkin +COPY ../ ${CATKIN_WS}/src WORKDIR $CATKIN_WS -RUN export ROS_INSTALL_PATH=$(find / -name setup.bash -print) -RUN ROS_VERSION=$(rosversion -d) - -# Print ROS installation path and version -RUN echo "ROS installed in: $ROS_INSTALL_PATH" -RUN echo "ROS version: $ROS_VERSION" +# Set the working directory for catkin # Initialize catkin workspace -RUN catkin init \ +RUN /bin/bash -c "source /opt/ros/$ROS_VERSION/setup.bash" \ + && catkin init \ && catkin config --cmake-args -DCATKIN_ENABLE_TESTING=0 # Initialize local catkin workspace, install dependencies and build workpsace -RUN echo "source /opt/ros/${ROS_VERSION}/setup.bash" >> ~/.bashrc -RUN source ~/.bashrc +RUN echo "source /opt/ros/${ROS_VERSION}/setup.bash" >> ~/.bashrc \ + && source ~/.bashrc RUN cd $CATKIN_WS \ - && rosdep init \ && rosdep update \ - && rosdep update --rosdistro ${ROS_VERSION} \ && rosdep fix-permissions \ && rosdep install -y --from-paths . --ignore-src --rosdistro ${ROS_VERSION} @@ -68,6 +58,6 @@ COPY ../scripts/catkin_setup.sh /usr/local/bin/catkin_setup.sh RUN echo "source /usr/local/bin/catkin_setup.sh" >> /root/.bashrc RUN chmod +x /usr/local/bin/catkin_setup.sh +# Run the packages and source RUN /usr/local/bin/catkin_setup.sh - CMD ["/bin/bash"] diff --git a/docker/Dockerfile.ros2 b/docker/Dockerfile.ros2 index b9d25d4..7e13714 100644 --- a/docker/Dockerfile.ros2 +++ b/docker/Dockerfile.ros2 @@ -15,7 +15,7 @@ ARG ROS_ARCHITECTURE_VERSION=latest -FROM ubuntu:20.04 as base_build +FROM ronaldsonbellande/bellande_robotic_environment_ros1:latest SHELL [ "/bin/bash" , "-c" ] ENV DEBIAN_FRONTEND noninteractive @@ -24,66 +24,32 @@ ENV PYTHON_VERSION="3.8" ARG ROS_ARCHITECTURE_VERSION_GIT_BRANCH=main ARG ROS_ARCHITECTURE_VERSION_GIT_COMMIT=HEAD -ARG ROS_VERSION=foxy -ENV CATKIN_WS=/root/catkin_ws +ENV ROS_VERSION=foxy +ENV CATKIN_WS=/opt/ros/overlay_ws LABEL maintainer=ronaldsonbellande@gmail.com LABEL author=ronaldsonbellande@gmail.com LABEL ROS_architecture_github_branchtag=${ROS_ARCHITECTURE_VERSION_GIT_BRANCH} LABEL ROS_architecture_github_commit=${ROS_ARCHITECTURE_VERSION_GIT_COMMIT} -# Ubuntu setup -RUN apt-get update -y -RUN apt-get upgrade -y - -# Set the working directory inside the Docker image -WORKDIR / - -# Copy all files from the parent directory to the Docker image root -COPY ../ ./ - -# Create a directory for the requirements -RUN mkdir -p /requirements - -# Copy specific files from the requirements directory to the "requirements" directory in the Docker image -COPY requirements/requirements.txt /requirements/requirements.txt -COPY requirements/system_requirements.txt /requirements/system_requirements.txt -COPY requirements/ros_requirements.txt /requirements/ros_requirements.txt -COPY requirements/ros_repository_requirements.txt /requirements/ros_repository_requirements.txt - -# Install dependencies for system -RUN apt-get update && apt-get install -y --no-install-recommends > ~/.bashrc -RUN source ~/.bashrc +RUN echo "source /opt/ros/${ROS_VERSION}/setup.bash" >> ~/.bashrc \ + && source ~/.bashrc RUN cd $CATKIN_WS \ - && rosdep init \ && rosdep update \ - && rosdep update --rosdistro ${ROS_VERSION} \ && rosdep fix-permissions \ && rosdep install -y --from-paths . --ignore-src --rosdistro ${ROS_VERSION} @@ -92,5 +58,6 @@ COPY ../scripts/colcon_setup.sh /usr/local/bin/colcon_setup.sh RUN echo "source /usr/local/bin/colcon_setup.sh" >> /root/.bashrc RUN chmod +x /usr/local/bin/colcon_setup.sh -ENTRYPOINT ["/usr/local/bin/colcon_setup.sh"] -CMD ["bash"] +# Run the packages and source +RUN /usr/local/bin/colcon_setup.sh +CMD ["/bin/bash"] diff --git a/scripts/catkin_setup.sh b/scripts/catkin_setup.sh index ec9e444..ff14f27 100755 --- a/scripts/catkin_setup.sh +++ b/scripts/catkin_setup.sh @@ -19,4 +19,4 @@ catkin build # Source workspace setup file -source devel/setup.bash +source /opt/ros/overlay_ws/devel/setup.bash