Files
pa11y-docker/Dockerfile
Ryan Hamilton ec2a86cebf
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 3m27s
fix: revert pa11y version to 4.2.0 in Dockerfile
2025-09-11 12:25:12 -05:00

123 lines
2.5 KiB
Docker

# 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 ${PA11Y_VERSION}
# Install dependencies and build
RUN npm install
# # Install dependencies and build
# RUN npm install && \
# 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
# Copy production configuration
COPY --chown=pa11y:pa11y production.json /app/config/production.json
# # Switch to non-root user
# USER pa11y
# # Expose ports
# EXPOSE 4000
# EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:4000/ && \
wget --no-verbose --tries=1 --spider http://localhost:3000/ || exit 1
# Start the application
CMD ["node", "index.js"]