chore: retire Jenkins et Docker, pnpm 12, Lighthouse CI

This commit is contained in:
Lucas committed 2026-10-20 20:51:47 +02:00
1 parent da8cbc96b5
commit 77a3a9d178
10 files changed
+2461 -328

No files matched your search

-4
View File
@@ -1,4 +0,0 @@
NODE_VERSION=24
CADDY_VERSION=2.10.2
LHCI_VERSION=0.15.x
ZENIKA_VERSION=124-with-node
+12 -11
View File
@@ -1,24 +1,25 @@
// Lighthouse CI : audit du site construit (dist/), lancé par la CI après le build.
// Le déploiement n'a lieu que si les quatre scores sont >= 90.
module.exports = {
ci: {
collect: {
staticDistDir: '/app/dist',
staticDistDir: './dist',
numberOfRuns: 1,
settings: {
chromeFlags: '--no-sandbox --disable-setuid-sandbox --headless=new --disable-gpu --disable-dev-shm-usage',
targets: ['filesystem'],
chromeFlags: '--no-sandbox --headless=new --disable-gpu --disable-dev-shm-usage',
},
numberOfRuns: 1
},
assert: {
assertions: {
'categories:performance': ['error', {minScore: 0.9}],
'categories:accessibility': ['error', {minScore: 0.9}],
'categories:best-practices': ['error', {minScore: 0.9}],
'categories:seo': ['error', {minScore: 0.9}],
'categories:performance': ['error', { minScore: 0.9 }],
'categories:accessibility': ['error', { minScore: 0.9 }],
'categories:best-practices': ['error', { minScore: 0.9 }],
'categories:seo': ['error', { minScore: 0.9 }],
},
},
upload: {
target: 'filesystem',
outputDir: './.lighthouseci', // C'est ici que Jenkins ira chercher les fichiers
target: 'filesystem',
outputDir: './.lighthouseci',
},
},
};
};
-9
View File
@@ -1,9 +0,0 @@
:80 {
root * /usr/share/caddy
file_server
# Client cache
header {
Cache-Control "public, max-age=86400"
}
}
-34
View File
@@ -1,34 +0,0 @@
ARG NODE_VERSION
ARG CADDY_VERSION
# --- BUILD ---
FROM node:${NODE_VERSION}-alpine AS build
RUN corepack enable && corepack prepare pnpm@latest --activate
ENV ASTRO_TELEMETRY_DISABLED=1
WORKDIR /app
# Copy depedencies
COPY package.json pnpm-lock.yaml ./
# Install pnpm with cache
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
PNPM_HOME="/pnpm" pnpm install --frozen-lockfile
# Copy all
COPY . .
# Check files
RUN pnpm run lint
RUN pnpm run check
# Build
RUN pnpm build
# --- DEPLOY ---
FROM caddy:${CADDY_VERSION}-alpine
COPY --from=build /app/dist /usr/share/caddy
COPY Caddyfile /etc/caddy/Caddyfile
EXPOSE 80
Vendored
-80
View File
@@ -1,80 +0,0 @@
pipeline {
agent any
environment {
DOCKER_HOST = "unix:///run/user/1001/docker.sock"
APP_VERSION = "${env.BRANCH_NAME}-${env.BUILD_NUMBER}"
DOCKER_CONFIG = "${env.WORKSPACE}/.docker"
}
stages {
stage('Build') {
steps {
// Get Caddy version
sh "cp .env.dist .env"
// Push portfolio version
sh "echo '\nPORTFOLIO_VERSION=${env.APP_VERSION}' >> .env"
echo "Building new portfolio version..."
sh "docker compose build"
}
}
// stage('Lighthouse Audit') {
// steps {
// // Create volumes but no run with safety
// sh "docker rm -f audit-tmp lighthouse-audit || true"
// sh "docker compose --profile audit create --no-build --remove-orphans lighthouse-audit"
// // Extract astro data from temp container to tmp-dist folder
// sh "docker create --name audit-tmp portfolio:${env.APP_VERSION}"
// sh "mkdir -p ./tmp-dist"
// sh "docker cp audit-tmp:/usr/share/caddy/. ./tmp-dist"
// sh "docker rm -f audit-tmp"
// // Inject data from tmp-dist and config to audit container
// sh "docker cp ./tmp-dist/. lighthouse-audit:/app/dist/"
// sh "docker cp .lighthouserc.cjs lighthouse-audit:/app/dist/audit-config.cjs"
// sh "rm -rf ./tmp-dist"
// // Now run
// sh "docker start -a lighthouse-audit"
// // Get reports
// sh "mkdir -p ./.lighthouseci"
// sh "docker cp lighthouse-audit:/app/.lighthouseci/. ./.lighthouseci/"
// // Clean
// sh "docker rm -f lighthouse-audit"
// }
// }
stage('Deploy') {
// Deploy only master branch
when {
branch 'master'
}
steps {
echo "Deploy new portfolio version..."
sh "docker compose up -d"
// Update caddy-reverse-proxy cache
sh "docker exec caddy-reverse-proxy caddy reload --config /etc/caddy/Caddyfile"
}
}
}
post {
always {
// echo "Publish Lighthouse audit..."
// publishHTML([
// allowMissing: true,
// alwaysLinkToLastBuild: true,
// keepAll: false,
// reportDir: '.lighthouseci',
// reportFiles: '*.html',
// reportName: 'Lighthouse Report'
// ])
echo "Clean unused image"
sh "docker image prune -f"
}
success { echo "Success !" }
failure { echo "Failed." }
}
}
-36
View File
@@ -1,36 +0,0 @@
services:
portfolio:
build:
context: .
args:
- NODE_VERSION=${NODE_VERSION}
- CADDY_VERSION=${CADDY_VERSION}
image: portfolio:${PORTFOLIO_VERSION}
container_name: portfolio
restart: always
networks:
- reverse-proxy
lighthouse-audit:
profiles:
- audit
image: zenika/alpine-chrome:${ZENIKA_VERSION}
container_name: lighthouse-audit
user: "0:0"
volumes:
- audit_dist:/app/dist
- audit_reports:/app/.lighthouseci
- npm_cache:/root/.npm
environment:
- CHROME_PATH=/usr/bin/chromium-browser
working_dir: /app
command: npx --prefer-offline @lhci/cli@${LHCI_VERSION} autorun --config=/app/dist/audit-config.cjs
volumes:
audit_dist:
audit_reports:
npm_cache:
networks:
reverse-proxy:
external: true
-28
View File
@@ -1,28 +0,0 @@
#!/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
docker cp lighthouse-audit:/app/.lighthouseci/. ./.lighthouseci/
# Clean container
docker rm -f lighthouse-audit
+4 -7
View File
@@ -9,7 +9,8 @@
"astro": "astro",
"lint": "eslint .",
"check": "astro check",
"prepare": "husky"
"prepare": "husky",
"lighthouse": "lhci autorun"
},
"dependencies": {
"@astrojs/check": "^0.9.6",
@@ -22,6 +23,7 @@
"devDependencies": {
"@commitlint/cli": "^20.3.1",
"@commitlint/config-conventional": "^20.3.1",
"@lhci/cli": "^0.15.1",
"@typescript-eslint/eslint-plugin": "^8.52.0",
"@typescript-eslint/parser": "^8.52.0",
"astro-eslint-parser": "^1.2.2",
@@ -30,10 +32,5 @@
"husky": "^9.1.7",
"typescript": "^5.9.3"
},
"pnpm": {
"onlyBuiltDependencies": [
"esbuild",
"sharp"
]
}
"packageManager": "pnpm@12.14.0"
}
+2442 -116
View File
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -1,3 +1,3 @@
ignoredBuiltDependencies:
- esbuild
- sharp
allowBuilds:
esbuild: true
sharp: false