pipeline { agent any stages { stage('Checkout') { steps { git branch: 'main', url: 'http://47.95.203.241:3000/ReeseLin/golang-dy-back.git', credentialsId: '932fcb89-1c39-4005-b664-15e862f09e20' } } stage('Build Go Binary') { steps { sh ''' docker run --rm -v $PWD:/app -w /app golang:1.22-alpine \ sh -c "go mod tidy && go build -o go-dy ." ''' } } stage('Build Docker Image') { steps { sh 'docker build -t go-dy:latest .' } } stage('Deploy') { steps { sh 'docker run -d -p 8090:18080 --name go-dy go-dy:latest' } } } }