diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e46cf020839a2b42aac250775920ed53954e59cb..25425691057398ffc6c65bda57575ade1d40c97e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,9 +12,16 @@ variables:
   GIT_SUBMODULE_DEPTH: 1
   XDG_CONFIG_HOME: $CI_PROJECT_DIR/tests/data
 
+documentation:
+  before_script:
+    # for opencv-python dependence
+    - apt-get update && apt-get install -y libgl1-mesa-glx > /dev/null
+    - !reference [.snippets, doc-prepare]
+
 tests:
   before_script:
-    - ls /idiap/resource/database/*
+    # for opencv-python dependence
+    - if [ "$TAG" == "docker" ]; then apt-get update && apt-get install -y libgl1-mesa-glx > /dev/null; fi
     # for pytorch quirks on linux
     - if [ "$TAG" == "docker" ]; then export OMP_NUM_THREADS=1; fi # Set the number of threads used to 1
     - !reference [.snippets, test-prepare]