diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2ee3e6cba83e8e8adde8fb2287ce79b003a8a8d4..342f765f07d68f85925e1221441e9aee455ac9d8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,8 +18,7 @@ before_script:
   - python -V  # Print out python version for debugging
   - apt-get -qq update
   - apt-get -qq install -y python3-virtualenv python3 python3-dev python3-pip gettext default-mysql-client default-libmysqlclient-dev
-  - export DJANGO_SETTINGS_MODULE=AKPlanning.settings_ci
-  - ./Utils/setup.sh --prod
+  - ./Utils/setup.sh --ci
   - mkdir -p public/badges public/lint
   - echo undefined > public/badges/$CI_JOB_NAME.score
   - source venv/bin/activate
@@ -70,6 +69,16 @@ lint:
       codequality: codeclimate.json
     when: always
 
+doc:
+  stage: test
+  script:
+    - cd docs
+    - make html
+    - cd ..
+  artifacts:
+    paths:
+      - docs/_build/html
+
 pages:
   stage: deploy
   image: alpine:latest
diff --git a/Utils/setup.sh b/Utils/setup.sh
index fafa334a57ad728e4c37fb3b7661f2b9e5c165b7..1c951824905e99e4650f40a562b633b92d7b8b02 100755
--- a/Utils/setup.sh
+++ b/Utils/setup.sh
@@ -15,6 +15,14 @@ source venv/bin/activate
 pip install --upgrade setuptools pip wheel
 pip install -r requirements.txt
 
+# set environment variable when we want to update in production
+if [ "$1" = "--prod" ]; then
+    export DJANGO_SETTINGS_MODULE=AKPlanning.settings_production
+fi
+if [ "$1" = "--ci" ]; then
+    export DJANGO_SETTINGS_MODULE=AKPlanning.settings_ci
+fi
+
 # Setup database
 python manage.py migrate
 
@@ -26,9 +34,12 @@ python manage.py compilemessages -l de_DE
 # Credentials are entered interactively on CLI
 python manage.py createsuperuser
 
-# Generate documentation
-cd docs
-make html
-cd ..
+# Generate documentation (but not for CI use)
+if [ -n "$1" = "--ci" ]; then
+    cd docs
+    make html
+    cd ..
+fi
+
 
 deactivate