How-To: Dockerized Laravel that just works
Blog post from Nullstone
This guide addresses common challenges faced when running Laravel applications in Docker, such as large image sizes, the need for frequent container restarts, and production-only configurations that are difficult to debug. It offers a streamlined approach to setting up a Laravel app with Docker that works seamlessly both locally and in production by optimizing for php-fpm, automatically adding static assets, and emitting logs to stdout/stderr, resulting in a compact image size of approximately 37MB. The setup includes a preconfigured nginx sidecar container and a default MySQL database, with instructions on how to extend configurations to use Postgres, Redis, or other dependencies. The guide also emphasizes the use of environment variables for configuring applications across different environments and hints at additional resources for deploying Dockerized Laravel apps to cloud platforms via Nullstone.