Skip to main content

Setup Jenkins in Linux server

 

  set up a global credential

 create pipeline

    configure build steps


  pipeline{

    agent any

    tools {nodejs "NodeJS"}

    stages {

        stage('Clone Repository'){

            steps{

                git branch: 'test',

                credentialsId: 'LP_DEV_SERVER',

                url: 'git@github.com:littlesprogrammers/Freelaneer_Backend_Microservice_Shared_User.git'

            }

        }

        

        stage('Install Dependencies'){

            steps {

                sh 'npm install'

            }

        }

          stage('Stop Container'){

            steps {

                sh 'docker stop $(docker ps -a -q --filter ancestor=ms_user_user)'

            }

        }

       

         stage('Delete Image'){

            steps {

                sh 'docker image rm ms_user_user -f'

            }

        }

         

         stage('NextJS Build'){

            steps {

                sh 'npx tsc'

            }

        }

        

         stage('Docker Build'){

            steps {

                sh  'docker-compose build'

            }

        }

         

        

         stage('Docker Up'){

            steps {

                sh  'docker run -d -p 6001:6001 ms_user_user '

            }

        }

        

    }

}

  

      

run pipeline


Comments

Popular posts from this blog

Intigrate POS Printer in asp.net core 6. Web Project

There are two methods to call POS printer to print PrintGuestCheck PayBill_Print using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using Tawoon.IT_SoftwareTemplate.BusinnessModels.BaseVM.Dashboard; using Tawoon.IT_SoftwareTemplate.BusinnessModels.Enum; using Tawoon.IT_SoftwareTemplate.Entities; using Tawoon.IT_SoftwareTemplate.Entities.Models; using System.IO; using System.Drawing.Printing; using System.Drawing; using System.Net.Sockets; using System.Text; using Microsoft.AspNetCore.Hosting; using Tawoon.IT_SoftwareTemplate.BusinnessModels.BaseVM; using Microsoft.Extensions.Options; using Tawoon.IT_SoftwareTemplate.Helper; using Microsoft.AspNetCore.Http; using System.Drawing.Imaging; namespace Tawoon.IT_SoftwareTemplate.Controllers { public class Dashboard...

Linux server setup

   New Linux server Config ------------------------------ 1. mongod 2. redis 3. nginx 4. postgresql 5. docker 6. rabbitMQ 7. ssh 8. kuberneies 9. Jenkins 10. HAproxy  11. Github 12. NVM 13. npm  Server Restart Check list ------------------------------ 1. mongod 2. redis 3. nginx 4. postgresql 5.docker 6. rabbitMQ 7. ssh Note: sudo systemctl status nginx Microservice Deployment Check list --------------------------------------- 1. change port in .env 2. change port in dockerfile 3. change port in docker-compose.yml file 4.  make sure using the right port when you  run docker -d -p 0000:0000 iamgeName