Create Jenkinsfile

This commit is contained in:
JanhviDahake 2025-07-11 19:09:53 +05:30 committed by GitHub
parent 85c5d93cbd
commit fb02608625
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

40
src/flask/Jenkinsfile vendored Normal file
View file

@ -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.'
}
}
}