diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 814e0771fbeb57ab28634865101dfbe14900d313..b5796c211478157ca8bfab7d4ca184a4e2dbab5c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,35 +1,25 @@
-stages:
-  - build
-  - build-release
-
-
-build: #This will be executed on every push. It builds an docker image, which is named after the branch, so you can always use the last state of the different branches.
+docker-build:
+  image: gitlab.jonasled.de/jonasled/buildx-docker:latest
   stage: build
-  except:
-    - master
+  services:
+    - docker:dind
+  before_script:
+    - docker context create build
+    - docker buildx create build --use
+    - docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
+    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
   script:
-    - echo "building for branch $CI_COMMIT_REF_NAME"
-    - cp VERSION app/
-    - sudo docker image prune -f #Delete old unused images
-    - sudo docker pull python:3
-    - sudo docker build -t gitlab.jonasled.de/jonasled/url_shorter_docker:$CI_COMMIT_REF_NAME . #Build the image with the name already set to push
-    - sudo docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY #Login to docker registry, username and password will be filled while executing
-    - sudo docker push gitlab.jonasled.de/jonasled/url_shorter_docker:$CI_COMMIT_REF_NAME #Push the image onto the Docker registry.
-
-
-build-release: #This will be executed if you push on master, it makes a new release (latest) image
-  stage: build
-  only:
-    - master
-  script:
-    - export version=`cat VERSION`
-    - echo "building branch $CI_COMMIT_REF_NAME, Version $version"
-    - git config --global user.name "build"
-    - git config --global user.email "noreply@jonasled.de"
-    - git tag -a $version -m "$version" #add a tag with the current version
-    - git push --tags -o ci.skip ssh://git@gitlab.jonasled.de/jonasled/url_shorter_docker #Push the tag to the repo ci.skip means don't build the image again. I've configured an ssh key for the runner user,so it can push via ssh.
-    - sudo docker image prune -f #Delete old unused images
-    - sudo docker pull python:3
-    - sudo docker build -t gitlab.jonasled.de/jonasled/url_shorter_docker . #Build the image with the name already set to push
-    - sudo docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY #Login to docker registry, username and password will be filled while executing
-    - sudo docker push gitlab.jonasled.de/jonasled/url_shorter_docker #Push the image onto the Docker registry.
\ No newline at end of file
+    - |
+      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 buildx build --platform linux/amd64,linux/arm,linux/arm64 --push --tag "$CI_REGISTRY_IMAGE${tag}" .
+  # Run this job in a branch where a Dockerfile exists
+  rules:
+    - if: $CI_COMMIT_BRANCH
+      exists:
+        - Dockerfile