modification v16 jenkins

This commit is contained in:
Jazze7 2024-11-06 14:46:22 +05:30
parent 0f59d10af1
commit 169046cf2e

20
Jenkinsfile vendored
View File

@ -69,39 +69,35 @@ pipeline {
}
}
stage('Deploy') {
steps {
script {
sshagent(credentials: [SSH_CREDENTIALS]) {
sh '''
ssh ${REMOTE_SERVER} << EOF
cd ${REMOTE_WORKSPACE}/cicid
docker pull ${DOCKER_IMAGE}:${DOCKER_TAG}
docker stop documentation-container || true
docker rm documentation-container || true
docker run -d -p 3000:3000 --name documentation-container ${DOCKER_IMAGE}:${DOCKER_TAG}
EOF
ssh ${REMOTE_SERVER} "cd ${REMOTE_WORKSPACE}/cicid && \
docker pull ${DOCKER_IMAGE}:${DOCKER_TAG} && \
docker stop documentation-container || true && \
docker rm documentation-container || true && \
docker run -d -p 3000:3000 --name documentation-container ${DOCKER_IMAGE}:${DOCKER_TAG}"
'''
}
}
}
}
stage('Update Nginx Configuration') {
steps {
script {
sshagent(credentials: [SSH_CREDENTIALS]) {
sh '''
ssh ${REMOTE_SERVER} << EOF
sudo nginx -t
sudo systemctl reload nginx
EOF
ssh ${REMOTE_SERVER} "sudo nginx -t && sudo systemctl reload nginx"
'''
}
}
}
}
}
post {