diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0bca1de73afae78b2c84564f393f7e65ea0a63e8..ca395b9df348896c4edb18234654feac06613453 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,36 +1,57 @@
 ---
 # Install external dependencies
-before_script:
-  - duneci-install-module https://gitlab.dune-project.org/fufem/dune-matrix-vector.git
+
+# For release-based jobs, we use corresponding images,
+# that already contain all core and staging dependencies.
+.release_based_job:
+  before_script:
+    - duneci-install-module https://gitlab.dune-project.org/fufem/dune-matrix-vector.git
+
+# For branch-based-based jobs, we need to install all dependencies manually.
+.branch_base_job:
+  before_script:
+    - . /duneci/bin/duneci-init-job
+    - duneci-install-module https://gitlab.dune-project.org/core/dune-common.git
+    - duneci-install-module https://gitlab.dune-project.org/core/dune-geometry.git
+    - duneci-install-module https://gitlab.dune-project.org/core/dune-localfunctions.git
+    - duneci-install-module https://gitlab.dune-project.org/staging/dune-uggrid.git
+    - duneci-install-module https://gitlab.dune-project.org/core/dune-grid.git
+    - duneci-install-module https://gitlab.dune-project.org/core/dune-istl.git
+    - duneci-install-module https://gitlab.dune-project.org/fufem/dune-matrix-vector.git
 
 # The 2.9 release is the one in Debian 12 ('bookworm', 'stable' at the time of writing)
 dune:2.9 debian-11 gcc-10 C++20:
+  extends: .release_based_job
   variables:
     DUNECI_BRANCH: releases/2.9
   image: registry.dune-project.org/docker/ci/dune:2.9-debian-11-gcc-10-20
-  before_script:
   script: duneci-standard-test
 
 # The 2.10 release is the one in Debian 13 ('trixie', 'testing' at the time of writing)
-dune:2.10 debian-11 clang-13  C++20:
-  variables:
-    DUNECI_BRANCH: releases/2.10
-  image: registry.dune-project.org/docker/ci/dune:git-debian-11-clang-13-20
-  script: duneci-standard-test
-
+# To test against 2.10 we need an image with the corresponding version of the core modules.
+# Unfortunately, there is no 2.10 image with a recent enough compiler.
 dune:2.10 debian-11 gcc-10  C++20:
+  extends: .release_based_job
   variables:
     DUNECI_BRANCH: releases/2.10
-  image: registry.dune-project.org/docker/ci/dune:git-debian-11-gcc-10-20
+  image: registry.dune-project.org/docker/ci/dune:2.10-debian-11-gcc-10-20
   script: duneci-standard-test
 
 # Also test with the current development branch
 dune:git debian-11 clang-13  C++20:
-  image: registry.dune-project.org/docker/ci/dune:git-debian-11-clang-13-20
+  extends: .branch_base_job
+#  image: registry.dune-project.org/docker/ci/dune:git-debian-11-clang-13-20
+  image: registry.dune-project.org/docker/ci/debian:11
+  variables:
+    DUNECI_TOOLCHAIN: clang-13-20
   script: duneci-standard-test
 
 dune:git debian-11 gcc-10  C++20:
-  image: registry.dune-project.org/docker/ci/dune:git-debian-11-gcc-10-20
+  extends: .branch_base_job
+#  image: registry.dune-project.org/docker/ci/dune:git-debian-11-gcc-10-20
+  image: registry.dune-project.org/docker/ci/debian:11
+  variables:
+    DUNECI_TOOLCHAIN: gcc-10-20
   script: duneci-standard-test
 
 # Check for spelling mistakes in text