27 lines
656 B
Groovy
27 lines
656 B
Groovy
pipeline {
|
|
agent any
|
|
stages {
|
|
stage('Checkout') {
|
|
steps {
|
|
git branch: 'main', url: 'http://47.95.203.241:3000/ReeseLin/golang-dy-back.git'
|
|
}
|
|
}
|
|
stage('Build') {
|
|
steps {
|
|
sh 'go mod tidy'
|
|
sh 'go build -o go-dy .'
|
|
}
|
|
}
|
|
stage('Deploy') {
|
|
steps {
|
|
sh '''
|
|
docker stop go-dy || true
|
|
docker rm go-dy || true
|
|
docker build -t go-dy .
|
|
docker run -d --name go-dy -p 8090:18080 go-dy
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
}
|