diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 332e652f5908511305fb585912c69c00425af3ea..ed71fd8dd3b2e97566a508dd3ea9317d32d5e877 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -59,33 +59,34 @@ documentation:pdf:
     paths:
     - documentation/design/documentation.pdf
 
-documentation:static:
+.mdbook_common: &rust
   before_script:
       - cargo install mdbook
   image:
-    name: rust
+    name: rustdocker/rust:stable
   stage: documentation
-  rules:
-    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
   script:
   - mdbook build ./documentation/ --dest-dir public
+  cache:
+    paths:
+    - target
+
+documentation:static:
+  rules:
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
   artifacts:
     paths:
       - public
     expire_in: 1 week
+  <<: *rust
 
 documentation:test:
-  before_script:
-      - cargo install mdbook
-  image:
-    name: rust
-  stage: documentation
   rules:
     - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
-  script:
-  - ls
-  - ls documentation
-  - mdbook build ./documentation/ --dest-dir public
+  cache:
+    paths:
+    - target
+  <<: *rust
 
 sast:
   variables: