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: