diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 195d65e12ac7ede7a092753696635f88c88afad4..8b4611d38a5ba172ff923053bfe33653ce5a5a14 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,7 +7,48 @@
 # See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
 stages:
 - test
+- build
+- deploy
+
 sast:
   stage: test
 include:
 - template: Security/SAST.gitlab-ci.yml
+
+build_master:
+  stage: build
+  image: docker:stable
+  services:
+    - docker:dind
+  before_script:
+    - echo "$CI_DOCKER_REGISTRY_TOKEN" | docker login -u "$CI_DOCKER_REGISTRY_USER" --password-stdin
+  script:
+    - docker build --pull -t "$CI_REGISTRY_IMAGE" ./
+    - docker push "$CI_REGISTRY_IMAGE"
+  environment:
+    name: production
+    url: https://qtool2.amiv.ethz.ch
+  only:
+    - main
+
+
+build_dev:
+  stage: build
+  image: docker:stable
+  services:
+    - docker:dind
+  before_script:
+    - echo "$CI_DOCKER_REGISTRY_TOKEN_DEV" | docker login -u "$CI_DOCKER_REGISTRY_USER_DEV" --password-stdin
+  script:
+    - docker build --pull -t "$CI_REGISTRY_IMAGE_DEV" ./
+    - docker push "$CI_REGISTRY_IMAGE_DEV"
+  environment:
+    name: development
+    url: https://qtool2-dev.amiv.ethz.ch
+
+deploy:
+  stage: deploy
+  image: amiveth/ansible-ci-helper
+  script:
+    - python /main.py
+