├── Dockerfile ├── LICENSE └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alekzonder/puppeteer:1 2 | 3 | # @see http://label-schema.org/rc1/ 4 | LABEL maintainer="Phase2 " \ 5 | org.label-schema.vendor="Phase2 " \ 6 | org.label-schema.name="Outrigger pa11y" \ 7 | org.label-schema.description="Docker image for pa11y, the CLI-based accessibility testing tool." \ 8 | org.label-schema.vcs-url="https://github.com/phase2/docker-pa11y" \ 9 | org.label-schema.docker.cmd="docker run -it --rm --cap-add=SYS_ADMIN outrigger/pa11y http://example.com" \ 10 | org.label-schema.docker.cmd.help="docker run --rm outrigger/pa11y" \ 11 | org.label-schema.docker.debug="docker exec -it $CONTAINER bash" \ 12 | org.label-schema.schema-version="1.0" 13 | 14 | USER root 15 | 16 | # Let's get pa11y v5 in here. Also adds http-server for running pa11y against staticly-generated HTML. 17 | RUN yarn global add pa11y@5 pa11y-ci@2 http-server 18 | 19 | USER pptruser 20 | 21 | ENTRYPOINT ["dumb-init", "--"] 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Phase2 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Outrigger pa11y 2 | 3 | > Docker image for pa11y, the CLI-based accessibility testing tool. 4 | 5 | [![GitHub tag](https://img.shields.io/github/tag/phase2/docker-pa11y.svg)](https://github.com/phase2/docker-pa11y) [![Docker Stars](https://img.shields.io/docker/stars/outrigger/pa11y.svg)](https://hub.docker.com/r/outrigger/pa11y) [![Docker Pulls](https://img.shields.io/docker/pulls/outrigger/pa11y.svg)](https://hub.docker.com/r/outrigger/pa11y) [![](https://images.microbadger.com/badges/image/outrigger/pa11y:dev.svg)](https://microbadger.com/images/outrigger/pa11y:dev "Get your own image badge on microbadger.com") 6 | 7 | This Docker image provides the use of [pa11y v5](https://github.com/pa11y/pa11y). 8 | (Note that the v5 version of that project is currently not in the master branch.) 9 | 10 | ## Usage Examples 11 | 12 | ### Docker Run 13 | 14 | This is a quick demonstration of how you can use pa11y to run checks against a 15 | given URL. 16 | 17 | ``` 18 | docker run -i --rm --cap-add=SYS_ADMIN \ 19 | --name pa11y outrigger/pa11y:1 http://outrigger.sh 20 | ``` 21 | 22 | ### Docker-Compose - Simple 23 | 24 | This is the docker-compose style to execute the same docker run command as above. 25 | 26 | ```yaml 27 | version: '3.3' 28 | services: 29 | pa11y: 30 | image: outrigger/pa11y:1 31 | container_name: projectname_${DOCKER_ENV:-local}_pa11y 32 | command: http://outrigger.sh 33 | network_mode: bridge 34 | cap_add: 35 | - SYS_ADMIN 36 | ``` 37 | 38 | ### Docker-Compose - Project 39 | 40 | This is an example service definition to run pa11y as part of your project. 41 | 42 | Since you would not run this operationally alongside your webserver, this should 43 | not be added to your main docker-compose.yml. Instead, it might go in a build.yml 44 | or wherever you are defining CLI or testing tools. 45 | 46 | ```yaml 47 | # docker-compose -f build.yml run --rm pa11y 48 | version: '3.3' 49 | services: 50 | pa11y: 51 | image: outrigger/pa11y:1 52 | container_name: projectname_${DOCKER_ENV:-local}_pa11y 53 | command: ["--config", "/code/pa11y/config.js"] 54 | network_mode: bridge 55 | volumes: 56 | # Inject your pa11y configuration. We assume you have a config.js script. 57 | - ./tests/pa11y/:/code/pa11y/ 58 | cap_add: 59 | - SYS_ADMIN 60 | ``` 61 | 62 | ### pa11y Configuration File 63 | 64 | This is a start for your configuration file. 65 | 66 | The default customizations to chrome ensures HTTPS errors are ignored and that Chrome has enough memory. 67 | 68 | ```js 69 | const browser = await puppeteer.launch({ 70 | ignoreHTTPSErrors: true, 71 | args: [ 72 | '--disable-dev-shm-usage' 73 | ], 74 | }); 75 | 76 | pa11y('http://outrigger.sh', { 77 | browser: browser 78 | }); 79 | 80 | browser.close(); 81 | ``` 82 | 83 | ### Screenshot Example 84 | 85 | This is an example of reaching around pa11y to the underlying screenshot tools 86 | built into the base puppeteer image we are using, [alekzonder/puppeteer](https://hub.docker.com/r/alekzonder/puppeteer/) 87 | 88 | ```bash 89 | docker run -it --rm \ 90 | --shm-size 1G \ 91 | -v $PWD:/screenshots \ 92 | --entrypoint "" 93 | outrigger/pa11y:1 \ 94 | screenshot_series 'http://outrigger.sh' 1366x768 95 | ``` 96 | 97 | ## Resources 98 | 99 | * General issues on Puppeteer should check out the [base Puppeteer image](https://hub.docker.com/r/alekzonder/puppeteer/). 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. 100 | * [Puppeteer Github Project](https://github.com/GoogleChrome/puppeteer) 101 | * [Official Puppeteer Docker guidance](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker) 102 | * [pa11y @ Github](https://github.com/pa11y/pa11y) 103 | 104 | ## Security Reports 105 | 106 | Please email outrigger@phase2technology.com with security concerns. 107 | 108 | ## Maintainers 109 | 110 | [![Phase2 Logo](https://s3.amazonaws.com/phase2.public/logos/phase2-logo.png)](https://www.phase2technology.com) 111 | --------------------------------------------------------------------------------