diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 16df49a..3d2919d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,9 @@
 stages:
         - build
+        - dockerize
+
+variables:
+        IMAGE_NAME: registry.gitlab.com/wolutator/mosquitto-with-auth
 
 build:
         stage: build
@@ -15,6 +19,7 @@ build:
         artifacts:
                 paths:
                   - opt/
+                  - generated-version.txt
         script:
                 - apt update
                 - apt install -y gcc g++ libssl-dev uuid-dev xsltproc docbook docbook-xsl libmariadbclient-dev
@@ -31,4 +36,23 @@ build:
                 - make
                 - cp auth-plug.so $BUILD_DIR/opt/lib
                 - popd
+                - VERSION=`cat VERSION`
+                - REFCNT=`git rev-list --all --count`
+                - echo -n "$VERSION.$REFCNT.$CI_COMMIT_REF_NAME" > generated-version.txt 
+
+dockerize:
+        stage: dockerize
+        image: docker:stable
+        tags:
+                - hottis
+                - linux
+                - docker
+        dependencies:
+                - build
+        script:
+                - VERSION=`cat generated-version.txt`
+                - docker build --tag $IMAGE_NAME:latest --tag $IMAGE_NAME:$VERSION .
+                - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
+                - docker push $IMAGE_NAME:latest
+                - docker push $IMAGE_NAME:$VERSION
 
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..4e00861
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,12 @@
+FROM debian:latest
+
+LABEL Maintainer="Wolfgang Hottgenroth <woho@hottis.de>"
+LABEL ImageName="registry.gitlab.com/wolutator/mosquitto-with-auth"
+
+RUN \
+  apt update && \
+  apt install -y libmariadbclient && \
+  apt install -y openssl && \
+  mv opt /
+
+