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-27 22:58:26 +00:00
|
|
|
stage('Generate templ files') {
|
2024-10-07 01:45:54 +00:00
|
|
|
agent {
|
|
|
|
docker {
|
2024-10-27 22:55:34 +00:00
|
|
|
image 'ghcr.io/a-h/templ:latest'
|
2024-10-07 01:45:54 +00:00
|
|
|
reuseNode true
|
|
|
|
}
|
2024-10-07 01:29:28 +00:00
|
|
|
}
|
|
|
|
steps {
|
2024-10-27 22:55:34 +00:00
|
|
|
sh 'templ generate'
|
2024-10-07 01:29:28 +00:00
|
|
|
}
|
|
|
|
}
|
2024-10-27 22:58:26 +00:00
|
|
|
stage('Build go binary') {
|
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'golang:latest'
|
|
|
|
reuseNode true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh 'go mod tidy'
|
|
|
|
sh 'go build main.go'
|
|
|
|
}
|
|
|
|
}
|
2024-10-07 11:45:58 +00:00
|
|
|
stage('Build static assets') {
|
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'node:22'
|
|
|
|
reuseNode true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh 'npm i -g pnpm'
|
|
|
|
sh 'pnpm i'
|
|
|
|
sh 'pnpm build'
|
|
|
|
}
|
|
|
|
}
|
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'
|
2024-10-07 02:59:20 +00:00
|
|
|
sh 'echo "DB_HOST=music-to-go-db" >> .env'
|
2024-10-07 02:50:00 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|