Compare commits
13 Commits
478ff5f85a
...
dea1cf453f
| Author | SHA1 | Date | |
|---|---|---|---|
| dea1cf453f | |||
| 97bbdfdf02 | |||
| 0be67f252a | |||
| 71663bcdb1 | |||
| 6987009cfb | |||
| 079f5a89e7 | |||
| c6b180ff45 | |||
| 9b261e4333 | |||
| ba71aadcb3 | |||
| 887354c288 | |||
| 330c96e5a2 | |||
| c270b631dd | |||
| 530fed2f7b |
@@ -4,7 +4,6 @@ module.exports = {
|
|||||||
staticDistDir: '/app/dist',
|
staticDistDir: '/app/dist',
|
||||||
settings: {
|
settings: {
|
||||||
chromeFlags: '--no-sandbox --disable-setuid-sandbox --headless=new --disable-gpu --disable-dev-shm-usage',
|
chromeFlags: '--no-sandbox --disable-setuid-sandbox --headless=new --disable-gpu --disable-dev-shm-usage',
|
||||||
targets: ['filesystem'],
|
|
||||||
},
|
},
|
||||||
numberOfRuns: 1
|
numberOfRuns: 1
|
||||||
},
|
},
|
||||||
|
|||||||
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 --no-build --remove-orphans lighthouse-audit"
|
sh "docker compose --profile audit create lighthouse-audit"
|
||||||
|
|
||||||
// Extract astro data from temp container to tmp-dist folder
|
// Extract astro data from image to tmp-dist
|
||||||
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,10 +32,9 @@ 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 start -a lighthouse-audit"
|
sh "docker compose --profile audit run lighthouse-audit"
|
||||||
|
|
||||||
// Get reports
|
// Get reports
|
||||||
sh "mkdir -p ./.lighthouseci"
|
sh "mkdir -p ./.lighthouseci"
|
||||||
@@ -43,6 +42,7 @@ pipeline {
|
|||||||
|
|
||||||
// Clean
|
// Clean
|
||||||
sh "docker rm -f lighthouse-audit"
|
sh "docker rm -f lighthouse-audit"
|
||||||
|
sh "rm -rf ./tmp-dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
|
|||||||
@@ -20,16 +20,14 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- audit_dist:/app/dist
|
- audit_dist:/app/dist
|
||||||
- audit_reports:/app/.lighthouseci
|
- audit_reports:/app/.lighthouseci
|
||||||
- npm_cache:/root/.npm
|
|
||||||
environment:
|
environment:
|
||||||
- CHROME_PATH=/usr/bin/chromium-browser
|
- CHROME_PATH=/usr/bin/chromium-browser
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
command: npx --prefer-offline @lhci/cli@${LHCI_VERSION} autorun --config=/app/dist/audit-config.cjs
|
command: npx @lhci/cli@${LHCI_VERSION} collect --config=/app/dist/audit-config.cjs
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
audit_dist:
|
audit_dist:
|
||||||
audit_reports:
|
audit_reports:
|
||||||
npm_cache:
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
reverse-proxy:
|
reverse-proxy:
|
||||||
|
|||||||
@@ -1,28 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Clean old audits and containers
|
|
||||||
rm -rf ./.lighthouseci
|
|
||||||
docker rm -f lighthouse-audit || true
|
|
||||||
|
|
||||||
# Load env file and avoid warning for unused portofolio version
|
|
||||||
if [ -f .env.dist ]; then
|
|
||||||
export $(grep -v '^#' .env.dist | xargs)
|
|
||||||
fi
|
|
||||||
export PORTFOLIO_VERSION="local-audit"
|
|
||||||
|
|
||||||
# Create container but no start
|
|
||||||
docker compose --profile audit create --no-build --remove-orphans lighthouse-audit
|
|
||||||
|
|
||||||
# Inject data and config to container
|
|
||||||
docker cp ./dist/. lighthouse-audit:/app/dist/
|
|
||||||
docker cp .lighthouserc.cjs lighthouse-audit:/app/dist/audit-config.cjs
|
|
||||||
|
|
||||||
# Now run
|
|
||||||
docker start -a lighthouse-audit
|
|
||||||
|
|
||||||
# Get reports
|
|
||||||
mkdir -p ./.lighthouseci
|
mkdir -p ./.lighthouseci
|
||||||
docker cp lighthouse-audit:/app/.lighthouseci/. ./.lighthouseci/
|
|
||||||
|
|
||||||
# Clean container
|
docker run --rm \
|
||||||
docker rm -f lighthouse-audit
|
--user 0:0 \
|
||||||
|
-v ./dist:/app/dist \
|
||||||
|
-v ./.lighthouserc.cjs:/app/.lighthouserc.cjs \
|
||||||
|
-v ./.lighthouseci:/app/.lighthouseci \
|
||||||
|
-w /app \
|
||||||
|
-e CHROME_PATH=/usr/bin/chromium-browser \
|
||||||
|
zenika/alpine-chrome:with-node \
|
||||||
|
npx @lhci/cli@0.15.x collect \
|
||||||
|
--config=/app/.lighthouserc.cjs
|
||||||
|
|||||||
Reference in New Issue
Block a user