innhold/Containerfile.test

33 lines
1.2 KiB
Text
Raw Permalink Normal View History

FROM php:8.4-cli-bookworm
# System dependencies + PHP sockets extension (required by pest-plugin-browser)
RUN apt-get update && apt-get install -y \
git unzip curl \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install sockets pcntl
# Node.js 22 LTS (required by pest-plugin-browser / Playwright)
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# WORKDIR matches where composer.json lives — Pest finds vendor/autoload.php here
# Tests are mounted at /app/tests via compose.test.yaml
WORKDIR /app
# Install PHP test dependencies
COPY tests/composer.json composer.json
RUN composer install --no-interaction --no-progress
# Install Playwright npm package (skip post-install browser download — we do it explicitly below)
RUN PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install playwright
# Install Playwright browsers (Chromium) with OS-level dependencies
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright
RUN ./node_modules/.bin/playwright install --with-deps chromium
ENTRYPOINT ["/app/vendor/bin/pest"]