Docker image for pa11y, the CLI-based accessibility testing tool.
This Docker image provides the use of pa11y v5. (Note that the v5 version of that project is currently not in the master branch.)
This is a quick demonstration of how you can use pa11y to run checks against a given URL.
docker run -i --rm --cap-add=SYS_ADMIN \
--name pa11y outrigger/pa11y:1 http://outrigger.sh
This is the docker-compose style to execute the same docker run command as above.
version: '3.3'
services:
pa11y:
image: outrigger/pa11y:1
container_name: projectname_${DOCKER_ENV:-local}_pa11y
command: http://outrigger.sh
network_mode: bridge
cap_add:
- SYS_ADMIN
This is an example service definition to run pa11y as part of your project.
Since you would not run this operationally alongside your webserver, this should not be added to your main docker-compose.yml. Instead, it might go in a build.yml or wherever you are defining CLI or testing tools.
# docker-compose -f build.yml run --rm pa11y
version: '3.3'
services:
pa11y:
image: outrigger/pa11y:1
container_name: projectname_${DOCKER_ENV:-local}_pa11y
command: ["--config", "/code/pa11y/config.js"]
network_mode: bridge
volumes:
# Inject your pa11y configuration. We assume you have a config.js script.
- ./tests/pa11y/:/code/pa11y/
cap_add:
- SYS_ADMIN
This is a start for your configuration file.
The default customizations to chrome ensures HTTPS errors are ignored and that Chrome has enough memory.
const browser = await puppeteer.launch({
ignoreHTTPSErrors: true,
args: [
'--disable-dev-shm-usage'
],
});
pa11y('http://outrigger.sh', {
browser: browser
});
browser.close();
This is an example of reaching around pa11y to the underlying screenshot tools built into the base puppeteer image we are using, alekzonder/puppeteer
docker run -it --rm \
--shm-size 1G \
-v $PWD:/screenshots \
--entrypoint ""
outrigger/pa11y:1 \
screenshot_series 'http://outrigger.sh' 1366x768
- General issues on Puppeteer should check out the base Puppeteer image. Note: you can follow the instructions in that README to take screenshots. Since this image is based on that, you should not need a further Docker iamge download.
- Puppeteer Github Project
- Official Puppeteer Docker guidance
Please email outrigger@phase2technology.com with security concerns.