[mutter/alatiera/docker-images] CI: add job to build the docker image



commit 2bc69242a8208b531bd8f310ba1121ba59e0f347
Author: Jordan Petridis <jpetridis gnome org>
Date:   Sun Nov 11 22:32:14 2018 +0200

    CI: add job to build the docker image
    
    This defines a template for building docker images as well as a
    job to build the fedora image thats mean to replace the one
    that's currently used.
    
    Close #381

 .gitlab-ci.yml | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index df15a050d..f05b48c20 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,45 @@
-image: registry.gitlab.gnome.org/gnome/mutter/master:v1
-
 stages:
+ - docker-image
  - build
 
 build-mutter:
+  image: registry.gitlab.gnome.org/gnome/mutter/master:v1
   stage: build
   script:
     - meson . build -Degl_device=true -Dwayland_eglstream=true
     - ninja -C build
     - ninja -C build install
+
+.docker base:
+  image: 'docker:stable'
+  services:
+    - docker:dind
+  script:
+    - export IMAGE="${CI_REGISTRY_IMAGE}/${ARCH}/${TAG}"
+    - export REF="${IMAGE}:${CI_COMMIT_SHA}"
+    - export LATEST="${IMAGE}:latest"
+
+    - docker build --pull -t ${REF} ${CONTEXT_DIR}
+    - docker image tag ${REF} ${LATEST}
+
+    # Push the images
+    - |
+      if [ "$CI_COMMIT_REF_NAME" = "master" ]; then
+        docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
+        docker push ${REF}
+        docker push ${LATEST}
+      fi
+
+docker fedora amd64:
+  extends: '.docker base'
+  stage: 'docker-image'
+  variables:
+    # When using dind, it's wise to use the overlayfs driver for
+    # improved performance.
+    DOCKER_DRIVER: 'overlay2'
+    ARCH: 'amd64'
+    TAG: 'fedora'
+    CONTEXT_DIR: '.gitlab-ci/'
+  only:
+    changes:
+      - '.gitlab-ci/Dockerfile'


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]