diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7cf78878845376a0dd61aecd5d1dc6085cf04ab9..259a7d8af378da8f271674aee54a593cdef502d4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,8 +18,14 @@ variables:
 
 build:
   stage: build
-  only:
-    - dev
+  rules:
+    # Always run the stage for the 'dev' branch
+    - if: '$CI_COMMIT_REF_NAME == "dev"'
+    # For Merge Requests, make the stage manual
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+      when: manual
+    # Otherwise, skip the stage
+    - when: never    
   needs: []
   variables:
     DOCKER_TLS_CERTDIR: ''
@@ -188,8 +194,14 @@ db-copy-20-rec:
 
 deploy-10-dev:
   stage: deploy
-  only:
-    - dev
+  rules:
+    # Always run the stage for the 'dev' branch
+    - if: '$CI_COMMIT_REF_NAME == "dev"'
+    # For Merge Requests, make the stage manual
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+      when: manual
+    # Otherwise, skip the stage
+    - when: never    
   needs: ['test', 'build']
   inherit:
     default: [before_script]