Skip to content

Latest commit

 

History

History
86 lines (62 loc) · 2.34 KB

README.md

File metadata and controls

86 lines (62 loc) · 2.34 KB

Laravel Octane Dockerfile Basic

License

A very basic bare bones, multi-stage Dockerfile for Laravel Octane powered web services and microservices.

The Docker configuration provides the following setup:

  • PHP 8.0 and 8.1 official DebianBuster-based images
  • Preconfigured JIT compiler and OPcache

PHP extensions

And the following PHP extensions are included:

  • OpenSwoole/Swoole with support of OpenSSL, HTTP/2, Native cURL hook for coroutines, mysqlnd and asynchronous DNS.
  • OPcache
  • Redis
  • PCNTL
  • BCMath
  • INTL
  • pdo_mysql
  • zip
  • cURL
  • GD
  • mbstring

Usage

Clone this repository:

git clone [email protected]:heyjordn/laravel-octane-dockerfile-basic.git

Copy cloned directory content including deployment directory, Dockerfile and .dockerignore into your Octane powered Laravel project Change directory to your Laravel project

Build your image:

docker build -t <image-name>:<tag> .

Start the container:

docker run -p <port>:9000 --rm <image-name>:<tag>

Configuration

There are something that you maybe want to configure:

  • Swoole HTTP server config in supervisord.app.conf
  • OPcache and JIT configurations in opcache.ini
  • PHP configurations in php.ini
  • ENTRYPOINT Bash script in entrypoint.sh option along with the build command

Recommended options for octane.php

// config/octane.php

return [
    'swoole' => [
        'options' => [
            'http_compression' => true,
            'http_compression_level' => 6, // 1 - 9
            'compression_min_length' => 20,
            'open_http2_protocol' => true
        ]
    ]
];

Todo

  • Reduce build time by removing extra extensions/deps.

License

This repository is open-sourced software licensed under the MIT license.

Special Thanks

Special thanks to exaco and laravel-octane-dockerfile for the head start, this is essentially that dockerfile without horizon, scheduler and some extra extensions. Check out laravel-octane-dockerfile to see the production ready file.