This project aims to provide a deployable docker image that can be used with AWS Lambda.
- url: (required) The url to be checked
- preset: Determines how performance metrics are scored and if mobile-only audits are skipped.
mobileordesktop. Defaults tomobile - onlyCategories: Only run the specified categories. Available categories: accessibility, best-practices, performance, pwa, seo [array]. Defaults to
["performance", "seo", "accessibility", "best-practices"]
Example of a full request body
{
"url": "https://google.com",
"preset": "desktop",
"onlyCategories": ["seo"]
}Ensure you have the VS Code AWS Toolkit and aws-sam-cli installed.
brew tap aws/tap
brew install aws-sam-cliRun the debugging configuration to simulate the API Gateway with a request. To change parameters check the launch.json file.
Build and run the image
docker build --build-arg PRODUCTION=false -t lighthouse . && docker run -p 9000:8080 lighthouseTesting the image (note that you can't fake an API gateway this way, you'll get an error that the JSON body is not defined)
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"url":"https://google.com"}'docker cp f21e94db26da:/var/task/package-lock.json package-lock.json