From 8110757606bad454fdc3b37593fc1f732996e161 Mon Sep 17 00:00:00 2001 From: Harri Makelin Date: Tue, 13 Aug 2024 11:23:42 +0100 Subject: [PATCH] Fix gisnav Dockerfile Simplifies the Dockerfile and fixes many Makefile targets that require the image to have an intact git repository --- docker/mavros/Dockerfile | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/docker/mavros/Dockerfile b/docker/mavros/Dockerfile index 17963d24..a3a64742 100644 --- a/docker/mavros/Dockerfile +++ b/docker/mavros/Dockerfile @@ -40,8 +40,11 @@ ENV ROS_DISTRO=${ROS_DISTRO} WORKDIR /opt/colcon_ws/src/ -# Copy package.xml only to install system dependencies -COPY ros/gisnav/package.xml gisnav/ros/gisnav/package.xml +# .git needed to make pre-commit and git describe work. We create a shallow +# copy of the repo to avoid carrying over all of commit history. +COPY . /tmp/gisnav +RUN git clone --depth 1 /tmp/gisnav/ gisnav/ && \ + rm -rf /tmp/gisnav # Install GISNav system dependencies - we will install # the setup.py python dependencies later. @@ -59,9 +62,6 @@ RUN git clone --branch release/1.14 https://github.com/px4/px4_msgs.git && \ cd .. && \ colcon build --packages-select px4_msgs -# Copy rest of gisnav ros2 package -COPY ros/ gisnav/ros - WORKDIR /opt/colcon_ws/src/gisnav/ # Install python dependencies, mainly torch and related CUDA deps @@ -73,9 +73,8 @@ RUN cd ros/gisnav && \ source install/setup.bash && \ colcon build --packages-select gisnav gisnav_msgs -COPY docker/mavros/gisnav/entrypoint.sh / - -RUN chmod +x /entrypoint.sh +RUN cp docker/mavros/gisnav/entrypoint.sh / && \ + chmod +x /entrypoint.sh # Download LightGlue pretrained weights RUN python3 -c \ @@ -87,8 +86,6 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && apt clean -COPY docs/ docs/ - # Node 18 for building the docs (Sphinx dependencies already in setup.py) RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \ && source ~/.nvm/nvm.sh \ @@ -97,12 +94,4 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | b && cd docs/vitepress \ && npm install -COPY Makefile .pre-commit-config.yaml LICENSE.md README.md pyproject.toml /opt/colcon_ws/src/gisnav/ - -# .git needed to make pre-commit and git describe work. We create a shallow -# copy of the repo to avoid carrying over all of commit history. -COPY .git /tmp/gisnav/.git -RUN git clone --depth 1 /tmp/gisnav/.git /opt/colcon_ws/src/gisnav/.git && \ - rm -rf /tmp/gisnav/.git - ENTRYPOINT ["/entrypoint.sh"]