diff --git a/Jenkinsfile b/Jenkinsfile
index 26af1606b249455a43583e483b65d043293ac621..553eeb5c6e09ec18bab1fac936fa9989583251b4 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,19 +1,33 @@
 pipeline {
-    agent any  // Changed from "label 'my-agent-label'"
+    agent any
+    
+    options {
+        timeout(time: 30, unit: 'MINUTES')
+    }
     
     stages {
         stage('Build') {
             steps {
-                sh 'chmod +x gradlew'  // to make gradlew executable
-                sh './gradlew clean build'
+                sh 'chmod +x gradlew'
+                // Limit memory usage for Gradle build
+                sh './gradlew --no-daemon --max-workers=1 clean build'
             }
         }
 
         stage('Deploy with Docker') {
             steps {
                 sh 'docker-compose down || true'
+                // Clean up unused resources before deploying
+                sh 'docker system prune -f'
                 sh 'docker-compose up -d'
             }
         }
     }
+    
+    post {
+        always {
+            sh 'docker system prune -f || true'
+            cleanWs()
+        }
+    }
 }
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index daa45ae5880222ef67ebcb4365510cf4a11e7603..8d711554b0c0708d15d230e5bdf4eba5a65cf38e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -13,8 +13,8 @@ services:
     deploy:
       resources:
         limits:
-          cpus: '0.5'
-          memory: 512M
+          cpus: '1'
+          memory: 1024M
     networks:
       - healthcare_network
       
@@ -31,7 +31,7 @@ services:
       resources:
         limits:
           cpus: '1'
-          memory: 1G
+          memory: 1536M
     networks:
       - healthcare_network
     depends_on: