From efed1c7443660eb622b68f1a07f82eb1e6fb3865 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20Nar=C3=A7on?= <nicolas.narcon@inrae.fr>
Date: Wed, 17 Aug 2022 22:25:20 +0200
Subject: [PATCH] FIX: ci docker build, same as decloud

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d61dcb6..dd28045 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,23 @@ image: docker:latest
 services:
 - docker:dind
 
+.dind_base:
+  tags: [dind]
+  image: docker/compose:1.29.2
+  variables:
+    DOCKER_TLS_CERTDIR: ""
+    DOCKER_HOST: tcp://docker:2375
+  services:
+    - name: docker:dind
+      command: [dockerd, '-H', 'tcp://0.0.0.0:2375']
+  before_script:
+    # docker login asks for the password to be passed through stdin for security
+    # we use $CI_REGISTRY_PASSWORD here which is a special variable provided by GitLab
+    # https://docs.gitlab.com/ce/ci/variables/predefined_variables.html
+    - echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
+
 build-image:
+  extends: .dind_base
   script:
     - docker build -t $CI_REGISTRY_IMAGE slides/.
     - docker push $CI_REGISTRY_IMAGE
\ No newline at end of file
-- 
GitLab