mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-29 15:53:31 +02:00
Use docker-compose for local scanning
This commit is contained in:
parent
049bbac27e
commit
f0a9866e0d
8 changed files with 12398 additions and 4 deletions
|
@ -61,3 +61,17 @@ Linters:
|
|||
```shell
|
||||
docker-compose exec app ./manage.py lint
|
||||
```
|
||||
|
||||
## Accessibility Scanning
|
||||
|
||||
The tool `pa11y-ci` is used to scan pages for compliance with a set of
|
||||
accessibility rules. The scan runs as part of our CI setup (see
|
||||
`.github/workflows/test.yaml`) but it can also be run locally. To run locally,
|
||||
just
|
||||
|
||||
```shell
|
||||
docker-compose run pa11y npm run pa11y-ci
|
||||
```
|
||||
|
||||
The URLs that `pa11y-ci` will scan are configured in `src/.pa11yci`. When new
|
||||
views and pages are added, their URLs should also be added to that file.
|
||||
|
|
6
src/.pa11yci
Normal file
6
src/.pa11yci
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"urls": [
|
||||
"http://app:8080/",
|
||||
"http://app:8080/health/"
|
||||
]
|
||||
}
|
|
@ -40,3 +40,18 @@ services:
|
|||
- POSTGRES_DB=app
|
||||
- POSTGRES_USER=user
|
||||
- POSTGRES_PASSWORD=feedabee
|
||||
|
||||
pa11y:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: node.Dockerfile
|
||||
cap_add:
|
||||
- SYS_ADMIN
|
||||
volumes:
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
working_dir: /app
|
||||
links:
|
||||
- app
|
||||
profiles:
|
||||
- pa11y
|
||||
|
|
10
src/node.Dockerfile
Normal file
10
src/node.Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
|||
FROM docker.io/cimg/node:current-browsers
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install app dependencies
|
||||
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
||||
# where available (npm@5+)
|
||||
COPY --chown=circleci:circleci package*.json ./
|
||||
|
||||
RUN npm install
|
12330
src/package-lock.json
generated
Normal file
12330
src/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
20
src/package.json
Normal file
20
src/package.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "getgov",
|
||||
"version": "1.0.0",
|
||||
"description": "========================",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"pa11y-ci": "pa11y-ci",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@uswds/uswds": "^3.1.0",
|
||||
"pa11y-ci": "^3.0.1",
|
||||
"sass": "^1.54.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@uswds/compile": "^1.0.0-beta.3"
|
||||
}
|
||||
}
|
|
@ -486,8 +486,8 @@ if DEBUG:
|
|||
"::1",
|
||||
]
|
||||
|
||||
# allow dev laptop to connect
|
||||
ALLOWED_HOSTS += ("localhost",)
|
||||
# allow dev laptop and docker-compose network to connect
|
||||
ALLOWED_HOSTS += ("localhost", "app")
|
||||
SECURE_SSL_REDIRECT = False
|
||||
SECURE_HSTS_PRELOAD = False
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.http import HttpResponse
|
||||
|
||||
|
||||
def health(request):
|
||||
return HttpResponse("OK")
|
||||
return HttpResponse('<html lang="en"><head><title>OK - Get.gov</title></head><body>OK</body>')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue