From f33ec2fc206096cbf93ea704c3439213eef6e265 Mon Sep 17 00:00:00 2001 From: Slava Date: Wed, 20 Mar 2024 20:16:34 +0000 Subject: [PATCH] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4fa885c..c673f55 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -67,16 +67,25 @@ qodana: paths: - ".qodana/results/" -build: +docker-build: + image: docker:latest + needs: ['pytest', 'qodana'] stage: build - needs: [ 'pytest' ] + services: + - docker:dind before_script: - - df - - cat /etc/resolv.conf - - cat /etc/hosts + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: - - docker build -t disord-bot-pisya . + - | + if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then + tag="" + echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" + else + tag=":$CI_COMMIT_REF_SLUG" + echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" + fi + - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . push: