Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions jenkins-setup/pipelines/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
pipeline {

agent {
docker {
image 'python:3.11-slim'
args '-v /var/run/docker.sock:/var/run/docker.sock' // so Docker works too
args '-v /var/run/docker.sock:/var/run/docker.sock'
}
}

environment {
APP_NAME = "patient-app"
DOCKER_USER = "shashitraining"
DOCKER_IMAGE = "${DOCKER_USER}/${APP_NAME}"
DOCKER_TAG = "${env.BUILD_NUMBER}" // or "latest" if you prefer
DOCKER_TAG = "${env.BUILD_NUMBER}"
APP_DIR = "logging"
}

stages {
stage('Build') {
stage('Install Docker CLI') {
steps {
echo "✅ Building Flask app..."
sh "python3 -m py_compile $APP_DIR/patient.py"
sh '''
apt-get update && apt-get install -y docker.io
docker --version
'''
}
}

stage('Test') {
stage('Build') {
steps {
echo "🧪 Running tests..."
sh "echo 'No tests yet - add pytest later'"
sh "python3 -m py_compile $APP_DIR/patient.py"
}
}

stage('Docker Build') {
steps {
script {
echo "🐳 Building Docker image $DOCKER_IMAGE:$DOCKER_TAG"
sh "docker build -t $DOCKER_IMAGE:$DOCKER_TAG $APP_DIR"
}
sh "docker build -t $DOCKER_IMAGE:$DOCKER_TAG $APP_DIR"
}
}

Expand Down
Loading