From 76e25681ed24da38b932d06602fbc48f05403d54 Mon Sep 17 00:00:00 2001
From: alex <a.croix@cylab.be>
Date: Tue, 11 Mar 2025 14:04:52 +0100
Subject: [PATCH] Add pipeline in gitlab-ci file

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e69de29..1bafdff 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -0,0 +1,67 @@
+stages:
+  - build
+  - release
+
+
+build:
+  image: docker:20.10.16
+  # run on a gitlab-runner that is configured with docker-in-docker
+  tags:
+    - dind
+  stage: build
+  except:
+    - tags
+  services:
+    - docker:20.10.16-dind
+  variables:
+    # use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
+    # mounts /certs directory for the service and build container
+    # needed for the Docker client to use the certificates
+    DOCKER_TLS_CERTDIR: "/certs"
+  before_script:
+    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+  script:
+    # use previous image as a cache to speedup build process
+    - docker pull $CI_REGISTRY_IMAGE:latest || true
+    - cd dexer/ && docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA .
+
+build:tagged:
+  image: docker:20.10.16
+  # run on a gitlab-runner that is configured with docker-in-docker
+  tags:
+    - dind
+  stage: build
+  # only for git tags
+  only:
+    - tags
+  services:
+    - docker:20.10.16-dind
+  variables:
+    # use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
+    # mounts /certs directory for the service and build container
+    # needed for the Docker client to use the certificates
+    DOCKER_TLS_CERTDIR: "/certs"
+  before_script:
+    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+  script:
+    # use previous image as a cache to speedup build process
+    - docker pull $CI_REGISTRY_IMAGE:latest || true
+    - cd dexer/ && docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --tag $CI_REGISTRY_IMAGE:latest .
+    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
+    - docker push $CI_REGISTRY_IMAGE:latest
+
+release:
+  stage: release
+  image: registry.gitlab.com/gitlab-org/release-cli:latest
+  rules:
+    - if: $CI_COMMIT_TAG
+  script:
+    - echo "running release_job"
+  # See https://docs.gitlab.com/ee/ci/yaml/#release
+  release:
+    tag_name: '$CI_COMMIT_TAG'
+    description: '$CI_COMMIT_TAG'
+
+
+
+
-- 
GitLab