init commit
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 58s

This commit is contained in:
2025-09-11 09:36:45 -05:00
parent b5dc1f9ca2
commit 934a22b4bb
8 changed files with 423 additions and 1 deletions

115
Dockerfile Normal file
View 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"]