Run Lighthouse in Docker
Run Unlighthouse in Docker containers for consistent CI/CD environments. Docker requires special Puppeteer configuration due to sandboxing restrictions.
Unlighthouse Config
It's recommended you only use the @unlighthouse/ci with Docker. Hosting the client does not have known support.
You will need to remove the Chrome sandbox in a Docker environment, this will require using an unlighthouse.config.ts file.
import { defineUnlighthouseConfig } from 'unlighthouse/config'
export default defineUnlighthouseConfig({
puppeteerOptions: {
headless: true,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-gpu',
'--ignore-certificate-errors',
],
},
})
If you're using the unlighthouse binary instead of the CI integration, then you will need to tell Unlighthouse not to use the server and close when
the reports are finished.
export default defineUnlighthouseConfig({
server: {
open: false,
},
hooks: {
'worker-finished': async () => {
process.exit(0)
},
},
})
Docker File
Please see the following community repos:
Device Configuration
Run Unlighthouse in desktop mode with the --desktop flag: npx unlighthouse --site <url> --desktop. Configure mobile, desktop, or custom viewports with throttling.
Dynamic Sampling
Automatically sample similar pages to reduce scan time for sites with many similar URLs like blogs or e-commerce.