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
Post a Comment