diff --git a/src/flask/Jenkinsfile b/src/flask/Jenkinsfile new file mode 100644 index 00000000..1e33b757 --- /dev/null +++ b/src/flask/Jenkinsfile @@ -0,0 +1,40 @@ +pipeline { + agent any + + environment { + VENV_DIR = 'venv' + } + + stages { + stage('Build') { + steps { + echo '📦 Creating virtual environment and installing dependencies...' + sh '/usr/bin/python3 -m venv $VENV_DIR' + sh '. $VENV_DIR/bin/activate && pip install -r requirements.txt' + } + } + + stage('Test') { + steps { + echo '✅ Running unit tests...' + sh '. $VENV_DIR/bin/activate && pytest' + } + } + + stage('Deploy') { + steps { + echo '🚀 Deploying Flask app...' + sh '. $VENV_DIR/bin/activate && nohup python app.py &' + } + } + } + + post { + success { + echo '✅ Build and deployment successful!' + } + failure { + echo '❌ Build or tests failed. Check logs.' + } + } +}