0% found this document useful (0 votes)
18 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)
18 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

pipeline {

agent any

stages {
stage('Checkout from Git') {
steps {
git branch: 'main', url:
'[Link]
}
}
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 [Link]
docker tag frontend:latest [Link]-south-
[Link]/frontend:${BUILD_NUMBER}
docker push
[Link]/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 [Link] "saiazure2612@[Link]"
// git config [Link] "sai2612-git"
// BUILD_NUMBER=${BUILD_NUMBER}
// echo $BUILD_NUMBER
// sed -i "s#image:.*#image: [Link]-
[Link]/frontend:$BUILD_NUMBER#g" [Link]
// git add .
// git commit -m "Update deployment Image to version \$
{BUILD_NUMBER}"
// git push
[Link] HEAD:main

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

You might also like