diff --git a/Jenkinsfile b/Jenkinsfile
index 17c0f7606e273e6e3171a9721c6fc43a7b1e58e1..a785938e1ca572e7920c6a53b793686f3ec59cb8 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -161,6 +161,12 @@ pipeline {
       agent {
         label 'docker-build'
       }
+      when {
+        anyOf {
+          environment name: 'ENVIRONMENT', value: 'production'
+          environment name: 'ENVIRONMENT', value: 'staging'
+        }
+      }
       steps {
         readTrusted 'src/main/docker/Dockerfile.jvm'
         unstash 'target'