Extremely simple Docker setup for Laravel projects with Laravel Octane, using the following application servers:
- Open Swoole
- Swoole
- RoadRunner
- FrankenPHP
FROM php:8.3-alpine
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN install-php-extensions pcntl sockets openswoole
COPY . /var/www
COPY .env.example /var/www/.env
WORKDIR /var/www
RUN composer install --no-dev
ENTRYPOINT ["php", "artisan", "octane:start", "--server=swoole", "--port=9801", "--workers=16", "--host=0.0.0.0"]
FROM php:8.3-alpine
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN install-php-extensions pcntl sockets swoole
COPY . /var/www
COPY .env.example /var/www/.env
WORKDIR /var/www
RUN composer install --no-dev
ENTRYPOINT ["php", "artisan", "octane:start", "--server=swoole", "--port=9802", "--workers=16", "--host=0.0.0.0"]
FROM php:8.3-alpine
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
COPY --from=ghcr.io/roadrunner-server/roadrunner:latest /usr/bin/rr /usr/local/bin/rr
RUN install-php-extensions pcntl sockets
COPY . /var/www
COPY .env.example /var/www/.env
WORKDIR /var/www
RUN composer install --no-dev
ENTRYPOINT ["php", "artisan", "octane:start", "--server=roadrunner", "--port=9803", "--workers=16", "--host=0.0.0.0"]
FROM php:8.3-alpine
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN install-php-extensions pcntl sockets
COPY . /var/www
COPY .env.example /var/www/.env
WORKDIR /var/www
ADD https://github.com/dunglas/frankenphp/releases/latest/download/frankenphp-linux-x86_64 /usr/local/bin/frankenphp
RUN chmod +x /usr/local/bin/frankenphp
RUN composer install --no-dev
ENTRYPOINT ["php", "artisan", "octane:start", "--server=frankenphp", "--port=9804", "--workers=16", "--host=0.0.0.0"]