diff --git a/.ci/coverage.sh b/.ci/coverage.sh
index 8f65cd655a0530c1797b3fb97ef887c758281a1f..e284914016a4db153108296ee9e129be2de88af9 100755
--- a/.ci/coverage.sh
+++ b/.ci/coverage.sh
@@ -4,6 +4,9 @@ set -ex
 
 cd build/
 
+# log lcov version
+lcov --version
+
 # Capture coverage info.
 lcov --directory . --capture --output-file coverage.info 
 
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..e17abffce9e4ca6f3ae834461634e7def790f14f
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,45 @@
+image: $CI_REGISTRY_IMAGE:0.3.0
+
+variables:
+  DOCKER_HOST: tcp://docker:2375
+  DOCKER_TLS_CERTDIR: ""
+  TRAVIS_OS_NAME: linux
+  CXX_VERSION: g++-8
+  CC_VERSION: gcc-8
+  COVERAGE: "ON"
+
+cache:
+  key: ${CI_COMMIT_REF_SLUG}
+  paths:
+    - .deps/
+
+services:
+  - name: docker:19.03.5-dind
+    alias: localhost
+
+before_script:
+  - docker info
+  - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+
+build:
+  image: registry.nheko.im/nheko-reborn/mtxclient:0.3.0
+  stage: build
+  tags:
+    - docker
+  script:
+    - docker pull $CI_REGISTRY_IMAGE:latest || true
+    - docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:0.3.0 . 
+    # Start synapse to run tests
+    - if [ $TRAVIS_OS_NAME == linux ]; then make synapse; fi
+    # Build the lib and run the linter & tests. 
+    - ./.ci/script.sh
+    - docker push $CI_REGISTRY_IMAGE:latest
+    - docker push $CI_REGISTRY_IMAGE:0.3.0
+
+  after_script:
+    # Generate coverage report and upload report to CodeCov.
+    - |
+      if [ $COVERAGE == ON ]; then
+        ./.ci/coverage.sh && \
+        bash <(curl -s https://codecov.io/bash) -f build/coverage.info || echo "Codecov failed"
+      fi
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index a33331206a3774022757ad2e35a3d1f0751a61e3..0793a407fc4373b0ad2f618d072dcdfdd74303d6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
 FROM ubuntu:16.04
 
-ENV LIBSODIUM_VERSION=1.0.16
+ENV LIBSODIUM_VERSION=1.0.17
 ENV SPDLOG_VERSION=1.1.0
 ENV OLM_VERSION=2.2.2
 ENV NLOHMANN_VERSION=v3.2.0
@@ -9,13 +9,15 @@ ENV CMAKE_SHORT_VERSION=3.15
 
 RUN \
     apt-get update -qq && \
-    apt-get install -y --no-install-recommends apt-transport-https software-properties-common curl ninja-build && \
+    apt-get install -y --no-install-recommends apt-transport-https software-properties-common curl ninja-build sudo && \
     # cmake
     curl https://cmake.org/files/v${CMAKE_SHORT_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh -o cmake-install.sh && \
     bash cmake-install.sh --skip-license --prefix=/usr/local && \
     export PATH="/usr/local/bin:$PATH" && \
     rm -f /*.sh && \
     # Toolchains
+    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \
+    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
     add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
     curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
     apt-add-repository "deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main" && \
@@ -31,13 +33,21 @@ RUN \
         g++-5 \
         unzip git lcov \
         libssl-dev \
-        openssl && \
+        openssl \
+        docker-ce && \
     sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 10 && \
     sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 10 && \
     sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-8 10 && \
     sudo update-alternatives --set gcc "/usr/bin/gcc-8" && \
     sudo update-alternatives --set g++ "/usr/bin/g++-8" && \
     sudo update-alternatives --set gcov "/usr/bin/gcov-8" && \
+    # lcov
+    mkdir -p build-lcov && \
+    ( cd build-lcov && \
+      curl -L http://downloads.sourceforge.net/ltp/lcov-1.14.tar.gz -o lcov-1.14.tar.gz && \
+      tar xfz lcov-1.14.tar.gz && \
+      cd lcov-1.14/ && \
+      sudo make install ) && \
     # libsodium
     mkdir -p /build/libsodium && cd /build/libsodium && \
     curl -L https://download.libsodium.org/libsodium/releases/libsodium-${LIBSODIUM_VERSION}.tar.gz -o libsodium-${LIBSODIUM_VERSION}.tar.gz && \