28 lines
1.1 KiB
Docker
28 lines
1.1 KiB
Docker
FROM node:20-bullseye
|
|
|
|
# Install Chromium and related deps at image build time so test runs are fast
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends chromium ca-certificates fonts-liberation curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Avoid puppeteer downloading its own Chromium when using puppeteer-core
|
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
|
|
# Copy only the puppeteer test folder so we can install deps into the image
|
|
WORKDIR /opt/puppeteer-test
|
|
# Copy package files (package-lock.json may not exist in workspace)
|
|
COPY tools/puppeteer-test/package.json ./
|
|
COPY tools/puppeteer-test/package-lock.json ./
|
|
|
|
# Install dependencies (if package-lock.json missing, npm ci will fail; fall back to npm i)
|
|
RUN set -eux; \
|
|
if [ -f package-lock.json ]; then npm ci --no-audit --no-fund --silent; else npm i --no-audit --no-fund --silent; fi
|
|
|
|
# Copy the rest of the test files
|
|
COPY tools/puppeteer-test/ /opt/puppeteer-test/
|
|
|
|
WORKDIR /opt/puppeteer-test
|
|
|
|
# Default entrypoint runs the test; the workspace is mounted by docker-compose
|
|
ENTRYPOINT ["node", "test.js"]
|