0% found this document useful (0 votes)
4 views2 pages

Front End

This document outlines a Jenkins pipeline for building and deploying a Docker image. It includes stages for checking out code from a Git repository, building a Docker image for a frontend application, and pushing the image to AWS ECR. The commented-out section suggests an additional stage for updating a deployment file in the Git repository with the new image version.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Front End

This document outlines a Jenkins pipeline for building and deploying a Docker image. It includes stages for checking out code from a Git repository, building a Docker image for a frontend application, and pushing the image to AWS ECR. The commented-out section suggests an additional stage for updating a deployment file in the Git repository with the new image version.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

pipeline {

agent any

stages {
stage('Checkout from Git') {
steps {
git branch: 'main', url:
'https://github.com/sai2612-git/2nd10WeeksofCloudOps-main.git'
}
}
stage("Docker Image Build") {
steps {
script {
dir('client') {
sh 'docker system prune -f'
sh 'docker container prune -f'
sh 'docker build -t frontend .'
}
}
}
}
stage("ECR Image Pushing") {
steps {
script {
sh '''
aws ecr get-login-password --region ap-south-1 | docker login
--username AWS --password-stdin 941377132483.dkr.ecr.ap-south-1.amazonaws.com
docker tag frontend:latest 941377132483.dkr.ecr.ap-south-
1.amazonaws.com/frontend:${BUILD_NUMBER}
docker push
941377132483.dkr.ecr.ap-south-1.amazonaws.com/frontend:${BUILD_NUMBER}
'''
}
}
}
// stage('Update Deployment file') {
// environment {
// GIT_REPO_NAME = "2nd10WeeksofCloudOps-main"
// GIT_USER_NAME = "sai2612-git"
// }
// steps {
// dir('kubernetes-files') {
// withCredentials([usernamePassword(credentialsId:
'GITHUB_CREDENTIALS', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')])
{
// sh '''
// git config user.email "[email protected]"
// git config user.name "sai2612-git"
// BUILD_NUMBER=${BUILD_NUMBER}
// echo $BUILD_NUMBER
// sed -i "s#image:.*#image: 941377132483.dkr.ecr.ap-
south-1.amazonaws.com/frontend:$BUILD_NUMBER#g" frontend-deploy-service.yaml
// git add .
// git commit -m "Update deployment Image to version \$
{BUILD_NUMBER}"
// git push
https://$GIT_USER:[email protected]/$GIT_USER_NAME/$GIT_REPO_NAME.git HEAD:main

// '''
// }
// }
// }
// }
}
}

You might also like