Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NODE_ENV=development
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use an official Node.js runtime as a parent image
FROM node:lts-alpine

ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

RUN apk update
RUN apk add --no-cache bash chromium

# Set the working directory in the container
WORKDIR /app

# Initialise app
COPY . .

# Install dependencies
RUN npm install

# Expose the port the app runs on
EXPOSE 4000

# Run the application
CMD ["node", "index.js"]
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,19 @@ The boot configurations for Pa11y Dashboard are as follows. Look at the sample J

This can either be an object containing [Pa11y Webservice configurations][pa11y-webservice-config], or a string which is the base URL of a Pa11y Webservice instance you are running separately. If using environment variables, prefix the webservice vars with `WEBSERVICE_`.

## Docker
You can also run Pa11y Dashboard using [Docker][docker]. In this case, you need to define your environment name, set up the appropriate config file for your environment and build the Docker image before starting the service.
```sh
# Define the environment name in .env, e.g. "development"
NODE_ENV=development
# Set up and modify the config file according to your environment
cp config/development.sample.json config/development.json
# Start the service
docker compose up --build -d
# Optionally, you can also build the image without starting the service
docker build --build-arg ENV=development -t pa11y-dashboard:development .
```

## Contributing

There are many ways to contribute to Pa11y Dashboard, we cover these in the [contributing guide](CONTRIBUTING.md) for this repo.
Expand Down Expand Up @@ -200,6 +213,7 @@ The following table lists the major versions available and, for each previous ma
Pa11y Dashboard is licensed under the [GNU General Public License 3.0][info-license].
Copyright © 2023, Team Pa11y and contributors

[docker]: https://www.docker.com/
[homebrew]: https://brew.sh/
[issues]: https://github.com/pa11y/pa11y-dashboard/issues?utf8=%E2%9C%93&q=is%3Aissue
[issues-create]: https://github.com/pa11y/pa11y-dashboard/issues/new
Expand Down
10 changes: 9 additions & 1 deletion config/development.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
"database": "mongodb://localhost/pa11y-webservice-dev",
"host": "0.0.0.0",
"port": 3000,
"cron": "0 30 0 * * *"
"cron": "0 30 0 * * *",
"chromeLaunchConfig": {
"args": [
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-gpu",
"--ignore-certificate-errors"
]
}
}
}
10 changes: 9 additions & 1 deletion config/production.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
"database": "mongodb://localhost/pa11y-webservice",
"host": "0.0.0.0",
"port": 3000,
"cron": "0 30 0 * * *"
"cron": "0 30 0 * * *",
"chromeLaunchConfig": {
"args": [
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-gpu",
"--ignore-certificate-errors"
]
}
}
}
29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
services:
pa11y_mongodb:
image: mongodb/mongodb-community-server:latest
container_name: pa11y_mongodb_1
restart: always
ports:
- "27017:27017" # Expose if needed for external access
volumes:
- mongodb_data:/data/db

pa11y_dashboard:
build:
context: .
dockerfile: Dockerfile
args:
NODE_ENV: ${NODE_ENV:-development}
image: pa11y-dashboard:${NODE_ENV:-development}
container_name: pa11y_dashboard_1
restart: always
ports:
- "4000:4000"
environment:
NODE_ENV: ${NODE_ENV:-development}
PORT: 4000
depends_on:
- pa11y_mongodb

volumes:
mongodb_data: