diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3023c68 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +*~ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..07a966e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM node:12 + +# Install requirements for chromium in the node:10 distribution (Debian 9 Stretch) +RUN set -ex \ + && apt-get update \ + && apt-get -q install -y -V \ + libx11-xcb1 libxtst6 libnss3 libxss1 libasound2 libgtk-3-0 \ + && rm -rf /var/lib/apt/lists/* + +# Expose necessary ports: +# dashboard: +EXPOSE 4000 +# webservice: +EXPOSE 3000 + +# Run as "node" to avoid security complaints from node and co +USER node +WORKDIR /home/node + +# Clone current pa11y-dashboard and install all depenencies (which include pa11y itself and pa11y-webservice) +RUN git clone https://github.com/pa11y/pa11y-dashboard.git pa11y-dashboard \ + && cd pa11y-dashboard \ + && npm install + +# Configure for our docker environment with "production" settings +ADD patty-dashboard.production.json pa11y-dashboard/config/production.json +ENV NODE_ENV production + +#COPY docker-entrypoint.sh entrypoint.sh + +WORKDIR pa11y-dashboard +CMD ["start"] +ENTRYPOINT ["npm"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..534ca72 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2020 Ernesto Baschny + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..20e578a --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +build: + docker-compose build + +run: + docker-compose up -d + +logs: + docker-compose logs -f dashboard diff --git a/README.md b/README.md new file mode 100644 index 0000000..710525b --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +docker-pa11y Dashboard in Docker +================================ + +Test the docker pa11y dashboard and webservice in a docker environment. + +Requirements +------------ +- Docker and the `docker-compose` tool +- Browser + +How to use +---------- +Simply start the containers (dashboard and mongo): + +If you have `make` installed: +``` +make run +``` +else: +``` +docker-compose up -d +``` + +Check the logs: +``` +make logs +``` +or: +``` +docker-compose logs -f dashboard +``` + +Go to the browser: + +http://localhost:4000/ + +See also +-------- +- https://pa11y.org/ +- https://github.com/pa11y/pa11y-dashboard +- https://github.com/pa11y/pa11y-webservice diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..134a1bc --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: "3.7" + +services: + dashboard: + build: . + ports: + - "4000:4000" + - "3000:3000" + networks: + - intern + mongodb: + image: mongo:3.6 + ports: + - "27017" + networks: + - intern + volumes: + - data:/data + +volumes: + data: + +networks: + intern: diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..be2a5a3 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +# Start up the dashboard. +cd /home/node/pa11y-dashboard && npm start diff --git a/patty-dashboard.production.json b/patty-dashboard.production.json new file mode 100644 index 0000000..ce26862 --- /dev/null +++ b/patty-dashboard.production.json @@ -0,0 +1,15 @@ +{ + "port": 4000, + "noindex": true, + "readonly": false, + "sitemessage": "Test Dashboard in Docker", + "webservice": { + "database": "mongodb://mongodb/pa11y-webservice", + "host": "127.0.0.1", + "port": 3000, + "cron": "0 30 0 * * *", + "chromeLaunchConfig": { + "args": ["--no-sandbox"] + } + } +}