Pipeline changes
+35 −1 · 3 files changed
-
codefiles/src/Dockerfile.primary+1 −1 -
codefiles/src/Dockerfile.secondary+1 −0 -
jenkins/Jenkinsfile+33 −0
@@ -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 @@ -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 @@ -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 }