pipeline for color app

declearative pipeline script

pipeline {
    agent any

    stages {
        stage("Code") {
            steps {
                echo "Cloning the Code"
                git url: "https://github.com/SarthakTyagiji/Color_Flipper.git", branch: "main"
            }
        } 
        stage("Build") {
            steps {
                echo "Building the code"
                sh "docker build -t notes-app ."
            }
        }
        stage("Push to Docker Hub") {
            steps {
                echo "Pushing the code to Docker Hub"
                withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'dockerhubPass', usernameVariable: 'dockerhubuser')]) {
                    sh "docker tag notes-app ${env.dockerhubuser}/color:latest"
                    // sh "docker tag notes-app01 ${env.dockerhubuser}/backend1-image:01"
                    sh "docker login -u ${env.dockerhubuser} -p ${env.dockerhubPass}"
                    sh "docker push ${env.dockerhubuser}/color:latest"
                    // sh "docker push ${env.dockerhubuser}/backend1-image:01"
                }
            }
        }
        stage("Deploy") {
            steps {
                echo "Deploying the code"
                sh "docker-compose down && docker-compose up -d"
            }
        }
    }
}