From 5f46fedb519e0f6c244f21ab92eee2fbf8318e36 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Mon, 28 Dec 2020 09:51:38 +0200
Subject: [PATCH] Bind mount /builds.

The issue I'm trying to address here is that because of the Docker
volume, /builds/foo is really /var/lib/docker/volumes/123/_data/foo.
This causes some interesting issues with addressing files with Docker
from inside a Docker container. Do it just on ns4 (for now, if it works
and needed I may do it on host01 too). Also, deploy to the kodi host
last because it has issues right now.
---
 deploy             | 8 +++++---
 docker-compose.yml | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/deploy b/deploy
index 14b0389..80dc37c 100755
--- a/deploy
+++ b/deploy
@@ -5,7 +5,7 @@ deploy() {
     echo "Deploying to $1" >&2
     export DOCKER_HOST="ssh://$1"
     export RUNNER_NAME="$1"
-    until docker-compose up --detach --remove-orphans 2>/dev/null; do true; done
+    until docker-compose up --detach --remove-orphans ; do true; done
     # shellcheck disable=SC2034
     for i in $(seq 12)
     do
@@ -25,8 +25,10 @@ then
     exit 1
 fi
 
+export REGISTER_RUN_UNTAGGED="true"
+export BUILDS='/builds'
+deploy "ns4.shore.co.il"
 export REGISTER_RUN_UNTAGGED="false"
+unset BUILDS
 deploy "host01.shore.co.il"
 deploy "kodi.shore.co.il"
-export REGISTER_RUN_UNTAGGED="true"
-deploy "ns4.shore.co.il"
diff --git a/docker-compose.yml b/docker-compose.yml
index d5c8ca5..7a2ea4e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -14,7 +14,7 @@ services:
     image: adarnimrod/gitlab-runner
     restart: always
     volumes:
-      - builds:/builds
+      - "${BUILDS:-builds}:/builds"
       - config:/etc/gitlab-runner
       - /var/run/docker.sock:/var/run/docker.sock
   crond:
-- 
GitLab