From 9e3683214d6a95102af478f5831a6fc9a8d78441 Mon Sep 17 00:00:00 2001 From: MARTIN Pierre-Alexandre <pierre-alexandre.martin@imt-atlantique.net> Date: Thu, 6 Feb 2025 17:19:16 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20d'une=20=C3=A9tape=20de=20build=20d'ima?= =?UTF-8?q?ge=20docker=20=C3=A0=20la=20pipeline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6f5e5ca..ef27d6d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,7 @@ image: node:22 stages: - build - test + - docker cache: - &global_cache_node_mods @@ -34,7 +35,6 @@ install: build: stage: build script: - - npm ci - npm run build artifacts: paths: @@ -59,6 +59,29 @@ lint: stage: test needs: - job: build - artifacts: true + artifacts: true script: - npm run lint + +build-image: + stage: docker + rules: + - if: $CI_COMMIT_BRANCH == "main" || + $CI_COMMIT_BRANCH == "dev" + image: + name: gcr.io/kaniko-project/executor:v1.23.2-debug + entrypoint: [""] + script: + - | + if [[ "$CI_COMMIT_BRANCH" == "main" ]]; then + TAG="latest" + else + TAG="dev" + fi + echo "Branch: $CI_COMMIT_BRANCH" + echo "Tag to be used: ${CI_REGISTRY_IMAGE}:$TAG" + - /kaniko/executor + --context "${CI_PROJECT_DIR}" + --dockerfile "${CI_PROJECT_DIR}/dockerfile" + --destination "${CI_REGISTRY_IMAGE}:${TAG}" + -- GitLab