FROM mlocati/php-extension-installer:2.4.0 as php-extension-installer
FROM composer:2.7.7 as composer
FROM spiralscout/roadrunner:2024.2.0 as roadrunner
FROM php:8.3-cli-alpine as php-base
RUN --mount=type=bind,from=php-extension-installer,source=/usr/bin/install-php-extensions,target=/usr/local/bin/install-php-extensions \
install-php-extensions \
gd \
zip \
xsl \
dom \
pdo \
exif \
intl \
grpc \
pcntl \
bcmath \
opcache \
sockets \
pdo_mysql \
pdo_pgsql \
&& apk del --no-cache ${PHPIZE_DEPS} ${BUILD_DEPENDS}
FROM php-base as production
WORKDIR /var/www
ENV COMPOSER_ALLOW_SUPERUSER=1
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY ./composer.* .
RUN composer config --no-plugins allow-plugins.spiral/composer-publish-plugin false && \
composer install --optimize-autoloader --no-dev --no-scripts --no-interaction
COPY --from=roadrunner /usr/bin/rr /var/www
EXPOSE 8080/tcp
COPY ./ .
CMD ./rr serve -c .rr.yaml
FROM production as dev
RUN --mount=type=bind,from=php-extension-installer,source=/usr/bin/install-php-extensions,target=/usr/local/bin/install-php-extensions \
install-php-extensions xdebug