refacto(ci): local and jenkins Lighthouse audit use common docker compose service #3
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@@ -21,9 +21,9 @@ pipeline {
|
|||||||
|
|
||||||
// Create volumes but no run with safety
|
// Create volumes but no run with safety
|
||||||
sh "docker rm -f audit-tmp lighthouse-audit || true"
|
sh "docker rm -f audit-tmp lighthouse-audit || true"
|
||||||
sh "docker compose --profile audit create lighthouse-audit"
|
sh "docker compose --profile audit create --no-build --remove-orphans lighthouse-audit"
|
||||||
|
|
||||||
// Extract astro data from image to tmp-dist
|
// Extract astro data from temp container to tmp-dist folder
|
||||||
sh "docker create --name audit-tmp portfolio:${env.APP_VERSION}"
|
sh "docker create --name audit-tmp portfolio:${env.APP_VERSION}"
|
||||||
sh "mkdir -p ./tmp-dist"
|
sh "mkdir -p ./tmp-dist"
|
||||||
sh "docker cp audit-tmp:/usr/share/caddy/. ./tmp-dist"
|
sh "docker cp audit-tmp:/usr/share/caddy/. ./tmp-dist"
|
||||||
@@ -32,9 +32,10 @@ pipeline {
|
|||||||
// Inject data from tmp-dist and config to audit container
|
// Inject data from tmp-dist and config to audit container
|
||||||
sh "docker cp ./tmp-dist/. lighthouse-audit:/app/dist/"
|
sh "docker cp ./tmp-dist/. lighthouse-audit:/app/dist/"
|
||||||
sh "docker cp .lighthouserc.cjs lighthouse-audit:/app/dist/audit-config.cjs"
|
sh "docker cp .lighthouserc.cjs lighthouse-audit:/app/dist/audit-config.cjs"
|
||||||
|
sh "rm -rf ./tmp-dist"
|
||||||
|
|
||||||
// Now run
|
// Now run
|
||||||
sh "docker compose --profile audit run lighthouse-audit"
|
sh "docker start -a lighthouse-audit"
|
||||||
|
|
||||||
// Get reports
|
// Get reports
|
||||||
sh "mkdir -p ./.lighthouseci"
|
sh "mkdir -p ./.lighthouseci"
|
||||||
@@ -42,7 +43,6 @@ pipeline {
|
|||||||
|
|
||||||
// Clean
|
// Clean
|
||||||
sh "docker rm -f lighthouse-audit"
|
sh "docker rm -f lighthouse-audit"
|
||||||
sh "rm -rf ./tmp-dist"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
|
|||||||
Reference in New Issue
Block a user