Multi stage build
This commit is contained in:
parent
84b80637bc
commit
78271404fb
@ -1,5 +1,5 @@
|
|||||||
# Stage 1: Build Stage
|
# Stage 1: Build Stage
|
||||||
FROM git.spirirobotics.com/spiri/services-ros1-core:main AS builder
|
FROM git.spirirobotics.com/spiri/services-ros1-core:main AS devenv
|
||||||
|
|
||||||
|
|
||||||
#We need to make sure to source the ROS environment in our dockerfile
|
#We need to make sure to source the ROS environment in our dockerfile
|
||||||
@ -13,20 +13,27 @@ WORKDIR /root/catkin_ws/src
|
|||||||
|
|
||||||
COPY ./ .
|
COPY ./ .
|
||||||
|
|
||||||
WORKDIR /root/catkin_ws
|
|
||||||
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && rosdep init"
|
|
||||||
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && rosdep update"
|
|
||||||
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && rosdep install --from-paths src -y"
|
|
||||||
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && catkin_make"
|
|
||||||
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && catkin_make install"
|
|
||||||
|
|
||||||
RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
|
|
||||||
RUN echo "source /root/catkin_ws/devel/setup.bash" >> ~/.bashrc
|
|
||||||
|
|
||||||
WORKDIR /root/catkin_ws
|
|
||||||
|
|
||||||
RUN apt-get clean
|
RUN apt-get clean
|
||||||
HEALTHCHECK {{HEALTHCHECK}}
|
HEALTHCHECK {{HEALTHCHECK}}
|
||||||
|
|
||||||
# Command to run your application
|
# Command to run your application
|
||||||
CMD {{RUN_COMMAND}} --wait --screen
|
CMD {{RUN_COMMAND}} --wait --screen
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /root/catkin_ws
|
||||||
|
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && rosdep init"
|
||||||
|
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && rosdep update"
|
||||||
|
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && rosdep install --from-paths src -y"
|
||||||
|
|
||||||
|
RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
|
||||||
|
RUN echo "source /root/catkin_ws/devel/setup.bash" >> ~/.bashrc
|
||||||
|
|
||||||
|
FROM devenv AS build
|
||||||
|
|
||||||
|
|
||||||
|
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && catkin_make"
|
||||||
|
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && catkin_make install"
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /root/catkin_ws
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
target: devenv
|
||||||
environment:
|
environment:
|
||||||
- "ROS_MASTER_URI=http://ros-master:11311"
|
- "ROS_MASTER_URI=http://ros-master:11311"
|
||||||
volumes:
|
volumes:
|
||||||
|
Loading…
Reference in New Issue
Block a user