perf: add npm cache and more secure deploy
Some checks failed
jenkins-ci Build failed

This commit is contained in:
2026-01-27 11:09:13 +00:00
parent 6491bb03b6
commit 54dc41b75a

12
Jenkinsfile vendored
View File

@@ -50,6 +50,8 @@ pipeline {
--volumes-from jenkins \ --volumes-from jenkins \
-w \$(pwd) \ -w \$(pwd) \
-e CHROME_PATH=/usr/bin/chromium-browser \ -e CHROME_PATH=/usr/bin/chromium-browser \
-v /home/lucas/.npm-cache:/tmp/npm-cache \
-e npm_config_cache=/tmp/npm-cache \
--entrypoint "" \ --entrypoint "" \
zenika/alpine-chrome:with-node \ zenika/alpine-chrome:with-node \
npx --prefer-offline -p @lhci/cli@0.13.0 lhci autorun --config=./.lighthouserc.cjs npx --prefer-offline -p @lhci/cli@0.13.0 lhci autorun --config=./.lighthouserc.cjs
@@ -63,14 +65,14 @@ pipeline {
stage('Deploy') { stage('Deploy') {
steps { steps {
echo "Deploying via Docker mount..." echo "Deploying via Docker mount..."
// Rsync with docker alpine // Copy with docker alpine
sh """ sh """
docker run --rm \ docker run --rm \
--volumes-from jenkins \ --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) \ -w \$(pwd) \
alpine:latest \ 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..." echo "Reloading Caddy..."
@@ -89,6 +91,10 @@ pipeline {
reportFiles: '*.html', reportFiles: '*.html',
reportName: 'Lighthouse Report' reportName: 'Lighthouse Report'
]) ])
echo "Cleaning up workspace..."
sh "rm -rf ./.lighthouseci"
script { script {
echo "Waiting for Gitea to be online..." echo "Waiting for Gitea to be online..."