diff --git a/jenkins-setup/pipelines/Jenkinsfile b/jenkins-setup/pipelines/Jenkinsfile index 016ac5f..812071d 100644 --- a/jenkins-setup/pipelines/Jenkinsfile +++ b/jenkins-setup/pipelines/Jenkinsfile @@ -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" } }