Dockerfile
ARG PHP_VERSION=8.1
FROM php:${PHP_VERSION}-cli as dev
ENV COMPOSER_ALLOW_SUPERUSER 1
WORKDIR /code
RUN apt-get update && apt-get install -y \
git \
unzip \
--no-install-recommends && rm -r /var/lib/apt/lists/*
COPY ./docker/php/php.ini /usr/local/etc/php/php.ini
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
FROM dev as ci
COPY composer.* ./
RUN composer install $COMPOSER_FLAGS --no-scripts --no-autoloader
COPY . .
RUN composer install $COMPOSER_FLAGS