Here is an example of a Dockerfile that can be used to build a Docker image with RoadRunner for a PHP application:
Note that this example utilizes a folder named app for your application. If your application is located in a different folder, feel free to customize this Dockerfile to suit your needs.
Dockerfile
FROM ghcr.io/roadrunner-server/roadrunner:2024 as roadrunner
FROM php:8.3-alpine
# https://github.com/mlocati/docker-php-extension-installer
# https://github.com/docker-library/docs/tree/0fbef0e8b8c403f581b794030f9180a68935af9d/php#how-to-install-more-php-extensions
RUN --mount=type=bind,from=mlocati/php-extension-installer:2,source=/usr/bin/install-php-extensions,target=/usr/local/bin/install-php-extensions \
install-php-extensions @composer-2 opcache zip intl sockets protobuf
COPY --from=roadrunner /usr/bin/rr /usr/local/bin/rr
EXPOSE 8080/tcp
WORKDIR /app
ENV COMPOSER_ALLOW_SUPERUSER=1
# Copy composer files from app directory to install dependencies
COPY ./app/composer.* .
RUN composer install --optimize-autoloader --no-dev
# Copy application files
COPY ./app .
# Run RoadRunner server
CMD ./rr serve -c .rr.yaml