init commit
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 58s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 58s
This commit is contained in:
70
.dockerignore
Normal file
70
.dockerignore
Normal file
@@ -0,0 +1,70 @@
|
||||
# Docker-specific files
|
||||
.dockerignore
|
||||
Dockerfile.*
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage/
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
# IDE/Editor files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS generated files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Build artifacts
|
||||
dist/
|
||||
build/
|
||||
|
||||
# Configuration files that might contain secrets
|
||||
config/production.json
|
||||
config/development.json
|
||||
config/test.json
|
17
.env.example
Normal file
17
.env.example
Normal file
@@ -0,0 +1,17 @@
|
||||
# Pa11y Dashboard Configuration
|
||||
# Copy this file to .env and customize as needed
|
||||
|
||||
# Port to expose Pa11y Dashboard on your host machine
|
||||
PA11Y_PORT=4000
|
||||
|
||||
# Make the dashboard read-only (true/false)
|
||||
READONLY=false
|
||||
|
||||
# Optional site message to display on homepage
|
||||
SITE_MESSAGE=Welcome to Pa11y Dashboard!
|
||||
|
||||
# Enable automatic testing with cron expression
|
||||
# Examples:
|
||||
# 0 2 * * * = Daily at 2 AM
|
||||
# 0 */6 * * * = Every 6 hours
|
||||
WEBSERVICE_CRON=false
|
48
.gitea/workflows/build.yml
Normal file
48
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install system Dependencies
|
||||
run: |
|
||||
apt-get update && apt-get install -y curl jq docker.io
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.portal.tulsacounty.org
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: gitea.portal.tulsacounty.org/${{ gitea.repository }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=sha,prefix={{branch}}-
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Environment files
|
||||
.env
|
||||
.env.local
|
||||
|
||||
# IDE/Editor files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# OS generated files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Docker volumes
|
||||
data/
|
||||
|
||||
# Configuration files that might contain secrets
|
||||
config/*.json
|
||||
!config/README.md
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
logs/
|
115
Dockerfile
Normal file
115
Dockerfile
Normal file
@@ -0,0 +1,115 @@
|
||||
# Multi-stage build for Pa11y Dashboard
|
||||
FROM node:18-bullseye-slim as builder
|
||||
|
||||
# Install system dependencies for Chrome
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ca-certificates \
|
||||
fonts-liberation \
|
||||
libappindicator3-1 \
|
||||
libasound2 \
|
||||
libatk-bridge2.0-0 \
|
||||
libatk1.0-0 \
|
||||
libcairo2 \
|
||||
libcups2 \
|
||||
libdbus-1-3 \
|
||||
libexpat1 \
|
||||
libfontconfig1 \
|
||||
libgbm1 \
|
||||
libglib2.0-0 \
|
||||
libgtk-3-0 \
|
||||
libnspr4 \
|
||||
libnss3 \
|
||||
libpango-1.0-0 \
|
||||
libpangocairo-1.0-0 \
|
||||
libx11-6 \
|
||||
libx11-xcb1 \
|
||||
libxcb1 \
|
||||
libxcomposite1 \
|
||||
libxcursor1 \
|
||||
libxdamage1 \
|
||||
libxext6 \
|
||||
libxfixes3 \
|
||||
libxi6 \
|
||||
libxrandr2 \
|
||||
libxrender1 \
|
||||
libxss1 \
|
||||
libxtst6 \
|
||||
lsb-release \
|
||||
wget \
|
||||
git \
|
||||
make \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Clone pa11y-dashboard repository
|
||||
ARG PA11Y_VERSION=4.2.0
|
||||
RUN git clone https://github.com/pa11y/pa11y-dashboard.git . && \
|
||||
git checkout v${PA11Y_VERSION}
|
||||
|
||||
# Install dependencies and build
|
||||
RUN npm ci --only=production && \
|
||||
make less && make uglify
|
||||
|
||||
# Production stage
|
||||
FROM node:18-bullseye-slim
|
||||
|
||||
# Install runtime dependencies for Chrome
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ca-certificates \
|
||||
fonts-liberation \
|
||||
libappindicator3-1 \
|
||||
libasound2 \
|
||||
libatk-bridge2.0-0 \
|
||||
libatk1.0-0 \
|
||||
libcairo2 \
|
||||
libcups2 \
|
||||
libdbus-1-3 \
|
||||
libexpat1 \
|
||||
libfontconfig1 \
|
||||
libgbm1 \
|
||||
libglib2.0-0 \
|
||||
libgtk-3-0 \
|
||||
libnspr4 \
|
||||
libnss3 \
|
||||
libpango-1.0-0 \
|
||||
libpangocairo-1.0-0 \
|
||||
libx11-6 \
|
||||
libx11-xcb1 \
|
||||
libxcb1 \
|
||||
libxcomposite1 \
|
||||
libxcursor1 \
|
||||
libxdamage1 \
|
||||
libxext6 \
|
||||
libxfixes3 \
|
||||
libxi6 \
|
||||
libxrandr2 \
|
||||
libxrender1 \
|
||||
libxss1 \
|
||||
libxtst6 \
|
||||
lsb-release \
|
||||
wget \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create app user
|
||||
RUN groupadd -r pa11y && useradd -r -g pa11y pa11y
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy application files from builder stage
|
||||
COPY --from=builder --chown=pa11y:pa11y /app /app
|
||||
|
||||
# Switch to non-root user
|
||||
USER pa11y
|
||||
|
||||
# Expose port
|
||||
EXPOSE 4000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:4000/ || exit 1
|
||||
|
||||
# Start the application
|
||||
CMD ["node", "index.js"]
|
58
README.md
58
README.md
@@ -1,2 +1,58 @@
|
||||
# pa11y-docker
|
||||
# Pa11y Dashboard Docker
|
||||
|
||||
A Docker container for [Pa11y Dashboard](https://github.com/pa11y/pa11y-dashboard) - a web interface for the Pa11y accessibility testing tool.
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. **Create environment configuration:**
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
2. **Start the services:**
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
3. **Access the dashboard:**
|
||||
- Open your browser to http://localhost:4000
|
||||
|
||||
## Configuration
|
||||
|
||||
Edit the `.env` file to customize the deployment:
|
||||
|
||||
```env
|
||||
# Basic settings
|
||||
PA11Y_PORT=4000 # Port to expose on host
|
||||
READONLY=false # Make dashboard read-only
|
||||
SITE_MESSAGE= # Custom homepage message
|
||||
|
||||
# Automation
|
||||
WEBSERVICE_CRON=false # Enable automatic testing (cron format)
|
||||
```
|
||||
|
||||
## Docker Compose Services
|
||||
|
||||
- **pa11y-dashboard**: The main dashboard application (port 4000)
|
||||
- **mongodb**: Database for storing test results and configuration
|
||||
|
||||
## Usage
|
||||
|
||||
1. Navigate to http://localhost:4000
|
||||
2. Click "Add URL" to add websites to test
|
||||
3. Configure accessibility standards (WCAG2AA recommended)
|
||||
4. Run tests and view detailed reports
|
||||
|
||||
## Building
|
||||
|
||||
The image is automatically built and pushed to the Gitea registry via GitHub Actions when code is pushed to main/master branches.
|
||||
|
||||
To build manually:
|
||||
```bash
|
||||
docker build -t pa11y-dashboard .
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This Docker packaging is provided under the MIT License. Pa11y Dashboard itself is licensed under GPL-3.0.
|
||||
|
||||
|
46
SUMMARY.md
Normal file
46
SUMMARY.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Pa11y Dashboard Docker Project Summary
|
||||
|
||||
## What This Provides
|
||||
|
||||
A minimal Docker setup for Pa11y Dashboard that:
|
||||
|
||||
1. **Builds automatically** via Gitea workflows when pushed to main/master
|
||||
2. **Pushes to your Gitea container registry**
|
||||
3. **Provides easy deployment** with docker-compose
|
||||
4. **Includes MongoDB** for data persistence
|
||||
5. **Configurable via environment variables**
|
||||
|
||||
## Key Files
|
||||
|
||||
- **Dockerfile**: Multi-stage build that pulls Pa11y Dashboard v4.2.0 from GitHub
|
||||
- **docker-compose.yml**: Runs pa11y-dashboard + MongoDB with health checks
|
||||
- **.gitea/workflows/build.yml**: Automated build and push to your Gitea registry
|
||||
- **.env.example**: Simple configuration template
|
||||
|
||||
## Quick Deploy
|
||||
|
||||
```bash
|
||||
# 1. Copy environment template
|
||||
cp .env.example .env
|
||||
|
||||
# 2. Start services
|
||||
docker-compose up -d
|
||||
|
||||
# 3. Access at http://localhost:4000
|
||||
```
|
||||
|
||||
## Gitea Registry
|
||||
|
||||
The workflow will automatically:
|
||||
- Build the Docker image on push to main/master
|
||||
- Tag with branch name, latest, and commit SHA
|
||||
- Push to `gitea.portal.tulsacounty.org/your-repo-name`
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- `PA11Y_PORT=4000` - Host port
|
||||
- `READONLY=false` - Make read-only
|
||||
- `SITE_MESSAGE=""` - Homepage message
|
||||
- `WEBSERVICE_CRON=false` - Auto-testing schedule
|
||||
|
||||
That's it! Simple and focused on your Gitea workflow needs.
|
46
docker-compose.yml
Normal file
46
docker-compose.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
services:
|
||||
mongodb:
|
||||
image: mongo:5.0
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- mongodb_data:/data/db
|
||||
environment:
|
||||
MONGO_INITDB_DATABASE: pa11y-webservice
|
||||
networks:
|
||||
- pa11y-network
|
||||
healthcheck:
|
||||
test: echo 'db.runCommand("ping").ok' | mongosh mongodb://localhost:27017/test --quiet
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
|
||||
pa11y-dashboard:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mongodb:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- ${PA11Y_PORT:-4000}:4000
|
||||
environment:
|
||||
NODE_ENV: ${NODE_ENV:-production}
|
||||
PORT: 4000
|
||||
NOINDEX: ${NOINDEX:-true}
|
||||
READONLY: ${READONLY:-false}
|
||||
SITE_MESSAGE: ${SITE_MESSAGE:-}
|
||||
WEBSERVICE_DATABASE: mongodb://mongodb:27017/pa11y-webservice
|
||||
WEBSERVICE_HOST: 0.0.0.0
|
||||
WEBSERVICE_PORT: 3000
|
||||
WEBSERVICE_CRON: ${WEBSERVICE_CRON:-false}
|
||||
networks:
|
||||
- pa11y-network
|
||||
|
||||
volumes:
|
||||
mongodb_data:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
pa11y-network:
|
||||
driver: bridge
|
Reference in New Issue
Block a user