From de4f315628f48fc83b50c4f6289a52b1d040245c Mon Sep 17 00:00:00 2001
From: Moritz Maxeiner <mm@ucw.sh>
Date: Mon, 9 Dec 2019 11:46:55 +0100
Subject: [PATCH] Automatically build&push CentOS 7 image

---
 .gitlab-ci.yml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9d3441d..8a0a753 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,6 +2,21 @@ stages:
   - build
   - deploy
 
+build centos-7:
+    stage: build
+    tags: [ linux, shell ]
+    before_script:
+      - echo "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" "${CI_REGISTRY}" --password-stdin
+    script:
+      - GPU_DRIVER_VERSION="$(dpkg-query --showformat='${Version}' --show 'nvidia-driver-*')"
+      - CACHE_FILE="/var/lib/gitlab-runner/.local/share/robofish-docker-gpu-driver-version"
+      - if [[ -f $CACHE_FILE ]] && [[ "$(cat $CACHE_FILE)" == "$GPU_DRIVER_VERSION" ]]; then OPTS=''; else OPTS='--no-cache'; fi
+      - echo -n $GPU_DRIVER_VERSION > $CACHE_FILE
+      - docker build $OPTS --pull -t "${CI_REGISTRY}/${CI_PROJECT_PATH,,}:centos-7" -f centos-7/Dockerfile centos-7
+      - docker push "${CI_REGISTRY}/${CI_PROJECT_PATH,,}:centos-7"
+    after_script:
+      - docker logout "${CI_REGISTRY}"
+
 build ubuntu-18.04:
   stage: build
   tags: [ linux, shell ]
-- 
GitLab