music-to-go/Jenkinsfile

62 lines
1.0 KiB
Plaintext
Raw Normal View History

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 {
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 {
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'
}
}
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 {
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:29:28 +00:00
}
}
}
}