FROM php:8.2-cli

# git/unzip for Composer; subversion + default-mysql-client for the WordPress
# test-library installer; lib headers for the gd/zip extensions the WP test
# suite and the image-resolution tests need (gd is used to generate a >2560px
# fixture image so WordPress produces a -scaled variant).
RUN apt-get update && apt-get install -y --no-install-recommends \
        git subversion unzip default-mysql-client \
        libzip-dev libpng-dev libjpeg-dev \
    && docker-php-ext-configure gd --with-jpeg \
    && docker-php-ext-install mysqli zip gd \
    && rm -rf /var/lib/apt/lists/*

# Composer (pinned for reproducibility).
COPY --from=composer:2.7 /usr/bin/composer /usr/bin/composer

COPY entrypoint.sh /usr/local/bin/run-plugin-tests
RUN chmod +x /usr/local/bin/run-plugin-tests

WORKDIR /plugin
ENTRYPOINT ["/usr/local/bin/run-plugin-tests"]
