diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3e9cf7f745c83656b709e7dbfa18215ef6757714..50694c162b292802841778e29c7ee67f3d20565c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,31 +1,39 @@
-# This file is a template, and might need editing before it works on your project.
-# Template project: https://gitlab.com/pages/jekyll
-# Docs: https://docs.gitlab.com/ce/pages/
-image: ruby:2.3
-
-variables:
-  JEKYLL_ENV: production
+image: kwarc/jekyll-website-deployer
+stages:
+  - deploy
 
 before_script:
-- bundle install
+  # setup locales
+  - echo "en_US UTF-8" > /etc/locale.gen
+  - which locale-gen || ( apt-get update -y && apt-get install locales )
+  - export LANG=en_US.UTF-8
+  - export LANGUAGE=en_US:en
+  - export LC_ALL=en_US.UTF-8
 
-test:
-  stage: test
-  script:
-  - bundle exec jekyll build -d test
-  artifacts:
-    paths:
-    - test
-  except:
-  - master
+  # install ssh-agent, unless already there
+  - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
+
+  # install rsync, unless already there
+  - 'which rsync || ( apt-get update -y && apt-get install rsync -y )'
+
+  # install bundler, unless already there
+  - 'which bundle || ( gem install bundler )'
 
-pages:
+  # and install the bundle
+  - bundle install
+
+  # setup ssh agent with the private key
+  - eval $(ssh-agent -s)
+  - ssh-add <(echo "$SSH_PRIVATE_KEY")
+  - mkdir -p ~/.ssh
+  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
+
+deploy_staging:
   stage: deploy
   script:
-  - bundle exec jekyll build -d public
-  artifacts:
-    paths:
-    - public
+    # build the website
+    - bundle exec jekyll build -d _site
+    # copy over all the files into the deployment folder
+    - cd _site && rsync -rv -e ssh --checksum ./ deploy@static.kwarc.info:/var/www/SIGMathLing.kwarc.info --delete
   only:
-  - master
-
+    - master