diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 13d2b95c37da1afc32229a4272074f1a9589f240..9507b8bedc263fbd45948adac7bc6d1396ef1892 100755
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,53 +8,69 @@ variables:
 .common_build:
   image: docker:latest
   stage: 🏗️ build_and_push
-  rules:
-    - changes: 
-      - $IMAGE_NAME/Dockerfile
-      - basis/*
   before_script:
     - docker login -u "$DOCKER_HUB_USER" -p $DOCKER_TOKEN
   script:
       - docker build -t "$DOCKER_HUB_USER/etp_$IMAGE_NAME" $IMAGE_NAME --no-cache;
       - docker push "$DOCKER_HUB_USER/etp_$IMAGE_NAME";
 
-.extend_build_image:
-  extends:
-    - .common_build
-  needs:  # if the build_and_push step basis has to be done, then make the other build_and_push steps dependend of it
-    - job: basis
-      optional: true # only run if basis is added to the pipeline (depends on the rules).
-
 basis:
   variables:
     IMAGE_NAME: "basis"
   extends:
     - .common_build
+  rules: # only execute if Dockerfile was changed
+    - changes: 
+      - $IMAGE_NAME/Dockerfile
 
 tp:
   variables:
     IMAGE_NAME: "tp"
   extends:
-    - .extend_build_image
+    - .common_build
+  needs:  # if the build_and_push step basis has to be done, then make the other build_and_push steps dependend of it
+    - job: basis
+      optional: true # only run if basis is added to the pipeline (depends on the rules).
+  rules: # only execute if Dockerfile or basis/Dockerfile was changed
+    - changes: 
+      - $IMAGE_NAME/Dockerfile
+      - basis/*
 
 python311:
   variables:
     IMAGE_NAME: "python311"
   extends:
-    - .extend_build_image
-
+    - .common_build
+  rules: # only execute if Dockerfile was changed
+    - changes: 
+      - $IMAGE_NAME/Dockerfile
+      
 basis_jupytermachine:
   variables:
     IMAGE_NAME: "basis_jupytermachine"
   extends:
-    - .extend_build_image
-
+    - .common_build
+  needs:  # if the build_and_push step basis has to be done, then make the other build_and_push steps dependend of it
+    - job: basis
+      optional: true # only run if basis is added to the pipeline (depends on the rules).
+  rules: # only execute if Dockerfile or basis/Dockerfile was changed
+    - changes: 
+      - $IMAGE_NAME/Dockerfile
+      - basis/*
+      
 tp_herwig:
   variables:
     IMAGE_NAME: "tp_herwig"
   extends:
-    - .extend_build_image
-
+    - .common_build
+  needs:  # if the build_and_push step basis has to be done, then make the other build_and_push steps dependend of it
+    - job: tp
+      optional: true # only run if basis is added to the pipeline (depends on the rules).
+  rules: # only execute if Dockerfile or tp/Dockerfile was changed
+    - changes: 
+      - $IMAGE_NAME/Dockerfile
+      - tp/*
+      
 create_jupytermachine_version:
   stage: create_jupytermachine_version
   image: docker:latest
diff --git a/tp_herwig/Dockerfile b/tp_herwig/Dockerfile
index 5e34ea73afc4292440b32acaa8c29c14c4444010..fca31f7dc0a0b849bd9187c4bee001d47062cb76 100644
--- a/tp_herwig/Dockerfile
+++ b/tp_herwig/Dockerfile
@@ -2,8 +2,6 @@ FROM jeppelt/etp_tp:latest
 
 USER root
 
-RUN python3 -m pip install bash_kernel
-
 RUN mkdir /herwig
 ENV INSTALL_LOC=/herwig