diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 811491d2847c21836f8d5d156d70fceb848f1526..07f7794939aa9f9505ad32e4521b0da73e8b1316 100755
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,49 +1,58 @@
-image: "clarinpl/python:3.6"
-cache:
-  paths:
-    - .tox
-stages:
-  - check_style
-  - test
-  - build
-
-pep8:
-  stage: check_style
-  before_script:
-    - pip install tox==2.9.1
-  script:
-    - tox -v -e pep8
-
-docstyle:
-  stage: check_style
-  before_script:
-    - pip install tox==2.9.1
-  script:
-    - tox -v -e docstyle
-
-test:
-  stage: test
-  image: "docker:18.09.7"
-  services:
-    - "docker:18.09.7-dind"
-  script:
-    - docker build -t clarinpl/wordifier .
-    - docker run --rm
-      -v "$(pwd)/requirements-dev.txt:/home/worker/requirements-dev.txt"
-      -v "$(pwd)/tests:/home/worker/tests"
-      clarinpl/wordifier
-      sh -c 'pip3 install -r requirements-dev.txt ; nose2 -v tests'
-
-build:
-  stage: build
-  image: "docker:18.09.7"
-  only:
-    - master
-  services:
-    - "docker:18.09.7-dind"
-  script:
-    - docker build -t clarinpl/wordifier .
-    - echo $DOCKER_PASSWORD > pass.txt
-    - cat pass.txt | docker login --username $DOCKER_USERNAME --password-stdin
-    - rm pass.txt
-    - docker push clarinpl/wordifier
+image: "clarinpl/python:3.6"
+cache:
+  paths:
+    - .tox
+stages:
+  - check_style
+  - test
+  - build
+
+pep8:
+  stage: check_style
+  before_script:
+    - pip install tox==2.9.1
+  script:
+    - tox -v -e pep8
+
+docstyle:
+  stage: check_style
+  before_script:
+    - pip install tox==2.9.1
+  script:
+    - tox -v -e docstyle
+
+test:
+  stage: test
+  image: "docker:18.09.7"
+  services:
+    - "docker:18.09.7-dind"
+  script:
+    - docker build -t clarinpl/wordifier .
+    - docker run --rm
+      -v "$(pwd)/requirements-dev.txt:/home/worker/requirements-dev.txt"
+      -v "$(pwd)/tests:/home/worker/tests"
+      clarinpl/wordifier
+      sh -c 'pip3 install -r requirements-dev.txt ; nose2 -v tests'
+
+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
+