2024-10-07 01:29:28 +00:00
|
|
|
pipeline {
|
2024-10-07 01:45:54 +00:00
|
|
|
agent any
|
2024-10-07 01:29:28 +00:00
|
|
|
stages {
|
2024-10-07 01:45:54 +00:00
|
|
|
stage('Install') {
|
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'golang:1.23-alpine'
|
|
|
|
reuseNode true
|
|
|
|
}
|
2024-10-07 01:29:28 +00:00
|
|
|
}
|
|
|
|
steps {
|
2024-10-07 01:45:54 +00:00
|
|
|
sh 'go mod tidy'
|
2024-10-07 01:29:28 +00:00
|
|
|
sh 'go build main.go'
|
|
|
|
}
|
|
|
|
}
|
2024-10-07 01:45:54 +00:00
|
|
|
stage('Populate env') {
|
2024-10-07 01:46:48 +00:00
|
|
|
steps {
|
|
|
|
sh 'rm .env || true'
|
2024-10-07 02:50:00 +00:00
|
|
|
sh 'echo "PORT=8007" >> .env'
|
|
|
|
sh 'echo "DB_HOST=localhost" >> .env'
|
|
|
|
sh 'echo "DB_PORT=5432" >> .env'
|
|
|
|
sh 'echo "DB_DATABASE=music" >> .env'
|
|
|
|
sh 'echo "DB_USERNAME=root" >> .env'
|
|
|
|
sh 'echo "DB_PASSWORD=root" >> .env'
|
|
|
|
sh 'echo "DB_SCHEMA=public" >> .env'
|
2024-10-07 01:46:48 +00:00
|
|
|
}
|
2024-10-07 01:45:54 +00:00
|
|
|
}
|
2024-10-07 01:29:28 +00:00
|
|
|
stage('Profit') {
|
|
|
|
steps {
|
2024-10-07 01:41:11 +00:00
|
|
|
dir('docker') {
|
2024-10-07 02:51:45 +00:00
|
|
|
sh 'docker-compose down || true'
|
2024-10-07 02:17:34 +00:00
|
|
|
sh 'docker-compose up -d --build'
|
2024-10-07 01:41:11 +00:00
|
|
|
}
|
2024-10-07 01:29:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|