From c3ec385ddb8255bd9e76ae30f1805257846b3a78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= <marcel.cochem@googlemail.com>
Date: Mon, 19 Jul 2021 13:33:19 +0200
Subject: [PATCH] quickfix to avoid kaniko stopping with "kaniko should only be
 run inside of a container, run with the --force flag if you are sure you want
 to continue" error applied as described here
 https://github.com/GoogleContainerTools/kaniko/issues/1542

its also done in veloren-docker-cli: https://gitlab.com/veloren/veloren-docker-ci/-/commit/c8aa8ac857292cf28e37dfd009c96c43ab02d206?merge_request_iid=50

We didnt had that problem in veloren repo until now.
---
 .gitlab/CI/publish.gitlab-ci.yml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/.gitlab/CI/publish.gitlab-ci.yml b/.gitlab/CI/publish.gitlab-ci.yml
index e08ffc2608..d943a87d07 100644
--- a/.gitlab/CI/publish.gitlab-ci.yml
+++ b/.gitlab/CI/publish.gitlab-ci.yml
@@ -24,6 +24,9 @@ docker:
   before_script:
     - ls "$CI_PROJECT_DIR/server-cli/"
   script:
+    # Help kaniko identify that it is running in a container.
+    # avoids this issue: https://github.com/GoogleContainerTools/kaniko/issues/1542
+    - export container=docker
     - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
     - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}/server-cli:${CI_COMMIT_REF_NAME}"
 
@@ -37,6 +40,9 @@ docker-nightly:
   before_script:
     - ls "$CI_PROJECT_DIR/server-cli/"
   script:
+    # Help kaniko identify that it is running in a container.
+    # avoids this issue: https://github.com/GoogleContainerTools/kaniko/issues/1542
+    - export container=docker
     - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
     - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}/server-cli:nightly"