DevOps

 DevOps


DevOps involves the practices and tools used to enable collaboration and automation between development and operations teams. It typically involves using tools such as Jenkins, Docker, and Kubernetes to automate the deployment and management of software applications.

Example of a Jenkins pipeline to build and deploy a web application:



pipeline {

  agent any

  stages {

    stage('Build') {

      steps {

        sh 'npm install'

        sh 'npm run build'

      }

    }

    stage('Test') {

      steps {

        sh 'npm test'

      }

    }

    stage('Deploy') {

      steps {

        sh 'docker build -t myapp .'

        withCredentials([usernamePassword(credentialsId: 'docker-creds', usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) {

          sh 'docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD'

        }

        sh 'docker tag myapp myrepo/myapp'

        sh 'docker push myrepo/myapp'

        sh 'kubectl apply -f deployment.yaml'

      }

    }

  }

}

No comments:

Post a Comment

The Importance of Cybersecurity in the Digital Age

 The Importance of Cybersecurity in the Digital Age Introduction: In today's digital age, where technology is deeply intertwined with ev...