From c7ad387d05ce2bcd99f8f5e6e3ab239d0ebd4b94 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Mon, 22 Mar 2021 11:08:26 +0100
Subject: [PATCH] Fix software locations in device container, make sure
 lofar-device-base is built first, as docker-compose does not support
 build-time dependencies.

---
 docker-compose/Makefile              | 2 ++
 docker-compose/device-pcc.yml        | 6 +++---
 docker-compose/device-sdp.yml        | 6 +++---
 docker-compose/lofar-device-base.yml | 1 +
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/docker-compose/Makefile b/docker-compose/Makefile
index 0b2f8f7c2..8162167c7 100644
--- a/docker-compose/Makefile
+++ b/docker-compose/Makefile
@@ -92,6 +92,8 @@ pull: ## pull the images from the Docker hub
 	$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) pull
 
 build: ## rebuild images
+	# docker-compose does not support build dependencies, so manage those here
+	$(DOCKER_COMPOSE_ARGS) docker-compose -f lofar-device-base.yml build
 	$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) build
 
 up: minimal  ## start the base TANGO system and prepare all services
diff --git a/docker-compose/device-pcc.yml b/docker-compose/device-pcc.yml
index 9054e10c3..db4848121 100644
--- a/docker-compose/device-pcc.yml
+++ b/docker-compose/device-pcc.yml
@@ -14,11 +14,11 @@ version: '2'
 
 services:
   device-pcc:
-    image: docker-compose_lofar-device-base:latest
+    image: lofar-device-base
     container_name: ${CONTAINER_NAME_PREFIX}device-pcc
     network_mode: ${NETWORK_MODE}
     volumes:
-        - ${TANGO_LOFAR_CONTAINER_DIR}:/opt/lofar
+        - ${TANGO_LOFAR_CONTAINER_MOUNT}
     environment:
       - TANGO_HOST=${TANGO_HOST}
     entrypoint:
@@ -27,4 +27,4 @@ services:
       - --timeout=30
       - --strict
       - --
-      - python3 -u /opt/lofar/PCC/PCC LTS -v
+      - python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/PCC/PCC LTS -v
diff --git a/docker-compose/device-sdp.yml b/docker-compose/device-sdp.yml
index 47dac3123..8671d8666 100644
--- a/docker-compose/device-sdp.yml
+++ b/docker-compose/device-sdp.yml
@@ -14,11 +14,11 @@ version: '2'
 
 services:
   device-sdp:
-    image: docker-compose_lofar-device-base:latest
+    image: lofar-device-base
     container_name: ${CONTAINER_NAME_PREFIX}device-sdp
     network_mode: ${NETWORK_MODE}
     volumes:
-        - ${TANGO_LOFAR_CONTAINER_DIR}:/opt/lofar
+        - ${TANGO_LOFAR_CONTAINER_MOUNT}
     environment:
       - TANGO_HOST=${TANGO_HOST}
     entrypoint:
@@ -27,4 +27,4 @@ services:
       - --timeout=30
       - --strict
       - --
-      - python3 -u /opt/lofar/SDP/SDP LTS -v
+      - python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/SDP/SDP LTS -v
diff --git a/docker-compose/lofar-device-base.yml b/docker-compose/lofar-device-base.yml
index a88304ec5..3d40f0f63 100644
--- a/docker-compose/lofar-device-base.yml
+++ b/docker-compose/lofar-device-base.yml
@@ -14,6 +14,7 @@ version: '2'
 
 services:
   lofar-device-base:
+    image: lofar-device-base
     build:
         context: lofar-device-base
     container_name: ${CONTAINER_NAME_PREFIX}lofar-device-base
-- 
GitLab