From 54dc41b75a17c44b7aafe50466fe7f34cec7e923 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 27 Jan 2026 11:09:13 +0000 Subject: [PATCH] perf: add npm cache and more secure deploy --- Jenkinsfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4a6fdde..446ab33 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,6 +50,8 @@ pipeline { --volumes-from jenkins \ -w \$(pwd) \ -e CHROME_PATH=/usr/bin/chromium-browser \ + -v /home/lucas/.npm-cache:/tmp/npm-cache \ + -e npm_config_cache=/tmp/npm-cache \ --entrypoint "" \ zenika/alpine-chrome:with-node \ npx --prefer-offline -p @lhci/cli@0.13.0 lhci autorun --config=./.lighthouserc.cjs @@ -63,14 +65,14 @@ pipeline { stage('Deploy') { steps { echo "Deploying via Docker mount..." - // Rsync with docker alpine + // Copy with docker alpine sh """ docker run --rm \ --volumes-from jenkins \ - -v ${env.DEPLOY_PATH}:${env.DEPLOY_PATH} \ + -v /home/lucas/services/static-sites/site-veloboomboom:/home/lucas/services/static-sites/site-veloboomboom \ -w \$(pwd) \ alpine:latest \ - sh -c "rm -rf ${env.DEPLOY_PATH}/* && cp -R ${env.SOURCE_DIR}/* ${env.DEPLOY_PATH}/" + sh -c "mkdir -p ../html-new && cp -R html/* ../html-new/ && mv -T ../html-new ../html-prod" """ echo "Reloading Caddy..." @@ -89,6 +91,10 @@ pipeline { reportFiles: '*.html', reportName: 'Lighthouse Report' ]) + + echo "Cleaning up workspace..." + sh "rm -rf ./.lighthouseci" + script { echo "Waiting for Gitea to be online..."