From 1f7b292cd7cc3c35f3bdb961deac2b7fecc47661 Mon Sep 17 00:00:00 2001
From: lukken <lukken@astron.nl>
Date: Fri, 23 Sep 2022 08:00:35 +0000
Subject: [PATCH] L2SS-951: Prevent unneeded excessive data movement in
 start-ds

---
 bin/start-ds.sh                             | 4 +++-
 docker-compose/lofar-device-base/Dockerfile | 7 ++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/bin/start-ds.sh b/bin/start-ds.sh
index 71cb29a29..35a7e3890 100755
--- a/bin/start-ds.sh
+++ b/bin/start-ds.sh
@@ -35,7 +35,9 @@ else
   # Install the package, exit 1 if it fails
   # pip install ./ will _NOT_ install dependencies in requirements.txt!
   rm -rf /tmp/tangostationcontrol
-  cp -R /opt/lofar/tango/tangostationcontrol /tmp/
+  # Ideally we would use git copy but it can't copy on subdirectory level
+  # DO NOT PUT SPACES IN THE EXCLUDE LIST!
+  rsync -av --progress --exclude={".tox","*.egg-info","dist","build",".git","*.pyc"} /opt/lofar/tango/tangostationcontrol /tmp/
   cd /tmp/tangostationcontrol || exit 1
   # Remove the build directory if copied from the source
   rm -rf build
diff --git a/docker-compose/lofar-device-base/Dockerfile b/docker-compose/lofar-device-base/Dockerfile
index fb65f701b..d280bf4f3 100644
--- a/docker-compose/lofar-device-base/Dockerfile
+++ b/docker-compose/lofar-device-base/Dockerfile
@@ -1,7 +1,12 @@
 ARG SOURCE_IMAGE
 FROM ${SOURCE_IMAGE}
 
-RUN sudo apt-get update && sudo apt-get install -y git g++ gcc shellcheck graphviz python3-dev libboost-python-dev pkg-config && sudo apt-get clean
+RUN sudo apt-get update
+RUN sudo apt-get install -y git && sudo apt-get clean
+RUN sudo apt-get install -y g++ gcc && sudo apt-get clean
+RUN sudo apt-get install -y shellcheck graphviz && sudo apt-get clean
+RUN sudo apt-get install -y python3-dev libboost-python-dev pkg-config && sudo apt-get clean
+RUN sudo apt-get install -y rsync && sudo apt-get clean
 
 COPY lofar-device-base/lofar-requirements.txt /lofar-requirements.txt
 RUN sudo pip3 install -r /lofar-requirements.txt
-- 
GitLab