From a8163416c5293799f32684664f97532ff2f8e15d Mon Sep 17 00:00:00 2001
From: Bartosz Ziemba <b.ziemba@protonmail.com>
Date: Tue, 27 Jul 2021 08:03:41 +0000
Subject: [PATCH] Update .gitlab-ci.yml

---
 .gitlab-ci.yml | 82 +++++++++++++++++++++++++++-----------------------
 1 file changed, 44 insertions(+), 38 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6949a7d..b12f676 100755
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,38 +1,44 @@
-image: 'clarinpl/python:3.6'
-
-cache:
-  paths:
-    - .tox
-
-stages:
-  - check_style
-  - build
-
-before_script:
-  - pip install tox==2.9.1
-
-pep8:
-  stage: check_style
-  script:
-    - tox -v -e pep8
-
-docstyle:
-  stage: check_style
-  script:
-    - tox -v -e docstyle
-
-build_image:
-  stage: build
-  image: docker:18.09.7
-  only:
-    - master
-  services:
-    - 'docker:18.09.7-dind'
-  before_script:
-    - ''
-  script:
-    - docker build -t clarinpl/speller2 .
-    - echo $DOCKER_PASSWORD > pass.txt
-    - cat pass.txt | docker login --username $DOCKER_USERNAME --password-stdin
-    - rm pass.txt
-    - docker push clarinpl/speller2
+image: 'clarinpl/python:3.6'
+
+cache:
+  paths:
+    - .tox
+
+stages:
+  - check_style
+  - build
+
+before_script:
+  - pip install tox==2.9.1
+
+pep8:
+  stage: check_style
+  script:
+    - tox -v -e pep8
+
+docstyle:
+  stage: check_style
+  script:
+    - tox -v -e docstyle
+
+build_image:
+  stage: build
+  image: 'docker:18.09.7'
+  only:
+    - master
+  services:
+    - 'docker:18.09.7-dind'
+  variables:
+    DOCKERHUB_NAME: clarinpl/$CI_PROJECT_NAME
+  before_script:
+    - ''
+  script:
+    - docker build -t $DOCKERHUB_NAME .
+    - echo $DOCKER_PASSWORD > pass.txt
+    - cat pass.txt | docker login --username $DOCKER_USERNAME --password-stdin
+    - rm pass.txt
+    - docker push $DOCKERHUB_NAME
+    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+    - docker image tag $DOCKERHUB_NAME $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
+    - docker image tag $DOCKERHUB_NAME $CI_REGISTRY_IMAGE:latest
+    - docker push $CI_REGISTRY_IMAGE
-- 
GitLab