From a0dcaeaea8eb3bbddc483670fd32bf86936106c1 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Fri, 22 Jan 2021 21:20:49 +0200
Subject: [PATCH] Personal registry.

---
 .gitlab-ci.yml     | 17 ++++++++++-------
 crond/Dockerfile   |  2 +-
 deploy             |  1 +
 docker-compose.yml |  5 +++--
 4 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f1b0ba..135eb44 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,16 +1,19 @@
 ---
 include:
+  - project: shore/ci-templates
+    file: templates/pre-commit.yml
   - project: shore/ci-templates
     file: templates/docker.yml
 
-build-host01:
-  extends: .compose-build
-  tags: [host01.shore.co.il]
+stages:
+  - test
+  - build
+  - deploy
 
-build-ns4:
+build:
   extends: .compose-build
   tags: [ns4.shore.co.il]
 
-build-kodi:
-  extends: .compose-build
-  tags: [kodi.shore.co.il]
+push:
+  extends: .compose-push
+  tags: [ns4.shore.co.il]
diff --git a/crond/Dockerfile b/crond/Dockerfile
index 994fbce..1c782c2 100644
--- a/crond/Dockerfile
+++ b/crond/Dockerfile
@@ -1,7 +1,7 @@
 FROM docker:19.03 as docker
 
 # hadolint ignore=DL3006
-FROM adarnimrod/cron as supersonic
+FROM registry.shore.co.il/cron as supersonic
 COPY --from=docker /usr/local/bin/docker /usr/local/bin/
 COPY --chown=root:root crontab /crontab
 # hadolint ignore=DL3002
diff --git a/deploy b/deploy
index 4c175e1..d7b555a 100755
--- a/deploy
+++ b/deploy
@@ -11,6 +11,7 @@ _deploy() {
     echo "Deploying to $1" >&2
     export DOCKER_HOST="ssh://$1"
     export RUNNER_NAME="$1"
+    until docker-compose pull --quiet; do true; done
     until docker-compose up --detach --remove-orphans ; do true; done
     # shellcheck disable=SC2034
     for i in $(seq 12)
diff --git a/docker-compose.yml b/docker-compose.yml
index 6046200..5e16ebb 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -6,13 +6,13 @@ services:
       context: runner/
     environment:
       CI_SERVER_URL: "${CI_SERVER_URL:-https://git.shore.co.il}"
-      DOCKER_IMAGE: docker:19.03
+      DOCKER_IMAGE: registry.shore.co.il/ci-images:docker
       DOCKER_NETWORK_MODE: &network gitlab-runner
       REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
       RUNNER_NAME: "${RUNNER_NAME}"
       REGISTER_RUN_UNTAGGED: "${RUN_UNTAGGED:-true}"
       RUNNER_TAG_LIST: "${RUNNER_NAME}"
-    image: adarnimrod/gitlab-runner
+    image: registry.shore.co.il/gitlab-runner
     restart: always
     volumes:
       - "${BUILDS:-builds}:/builds"
@@ -21,6 +21,7 @@ services:
   crond:
     build:
       context: crond/
+    image: registry.shore.co.il/gitlab-runner-cron
     volumes:
       - /run/docker.sock:/run/docker.sock
 
-- 
GitLab