← azuredeploy

Pipeline changes

8c395d2bdf0bf8ef7ebff55ddc90b43ee9f3adca · ovidiucs · Mar 15, 2024 14:31

+35 −1 · 3 files changed

  • codefiles/src/Dockerfile.primary +1 −1
  • codefiles/src/Dockerfile.secondary +1 −0
  • jenkins/Jenkinsfile +33 −0
diff --git a/codefiles/src/Dockerfile.primary b/codefiles/src/Dockerfile.primary
index 581cedf..54969f4 100644
--- a/codefiles/src/Dockerfile.primary
+++ b/codefiles/src/Dockerfile.primary
@@ -3,7 +3,7 @@ FROM python:3.8-slim
 RUN apt-get update && apt-get install -y procps iproute2 netcat-traditional && rm -rf /var/lib/apt/lists/*
 # Set the working directory in the container
 WORKDIR /app
-
+ENV PYTHONUNBUFFERED 1
 # Copy the current directory contents into the container at /app
 COPY ./primary /app
 
diff --git a/codefiles/src/Dockerfile.secondary b/codefiles/src/Dockerfile.secondary
index 9dfc7e3..e9291bc 100644
--- a/codefiles/src/Dockerfile.secondary
+++ b/codefiles/src/Dockerfile.secondary
@@ -4,6 +4,7 @@ RUN apt-get update && apt-get install -y procps iproute2 netcat-traditional && r
 # Set the working directory in the container
 WORKDIR /app
 
+ENV PYTHONUNBUFFERED 1
 # Copy the current directory contents into the container at /app
 COPY ./secondary /app
 
diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile
index 386fc8d..37a2207 100644
--- a/jenkins/Jenkinsfile
+++ b/jenkins/Jenkinsfile
@@ -1,26 +1,59 @@
 pipeline {
     agent any
     
+    environment {
+        DOCKER_IMAGE_NAME = 'your-docker-image-name'
+        DOCKERFILE_PATH = 'path/to/Dockerfile'
+    }
+    
     triggers {
         pollSCM('H/5 * * * *') // Poll every five minutes as an example
     }
     
     stages {
+    
         stage('Checkout') {
             steps {
                 checkout scm
             }
         }
+        
+        stage('Build Docker Image') {
+            steps {
+                script {
+                    // Authenticate with Docker registry
+                    docker.withRegistry('https://registry.example.com', 'myCRCredentials') {
+                        // Build Docker image
+                        docker.build(DOCKER_IMAGE_NAME, "-f ${DOCKERFILE_PATH} .")
+                    }
+                }
+            }
+        }
+        
+        stage('Push Docker Image') {
+            steps {
+                script {
+                    // Authenticate with Docker registry
+                    docker.withRegistry('https://registry.example.com', 'myCRCredentials') {
+                        // Push Docker image to registry
+                        docker.image(DOCKER_IMAGE_NAME).push('latest')
+                    }
+                }
+            }
+        }
+        
         stage('Build') {
             steps {
                 sh 'echo clean'
             }
         }
+        
         stage('Test') {
             steps {
                 sh 'echo test'
             }
         }
+        
         // Add more stages as needed
     }