Search by

inisium / laravel-compose

Inisium

Generate a production Dockerfile and docker-compose.yaml (serversideup/php, Coolify-ready) for a Laravel application.

Package info

github.com/Inisium/laravel-compose

pkg:composer/inisium/laravel-compose

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-10-01 07:45 UTC

This package is auto-updated.

Last update: 2026-10-01 09:28:21 UTC


README

Generate a production Dockerfile and docker-compose.yaml (serversideup/php, Coolify-ready) for a Laravel application.

What it generates

  • Dockerfile: multi-stage build.
    • base: serversideup/php fpm-nginx (Debian trixie, pinned version) with the PHP extensions you need.
    • build: Composer install, plus the front-end build (pnpm or npm) when the project has a package.json.
    • runtime: the application with production PHP, opcache, php-fpm and nginx settings, running as www-data on port 8080.
  • .dockerignore
  • docker-compose.yaml: one image for every service, told apart by their command.
    • app: nginx + php-fpm.
    • queue (optional): several queue:work processes under supervisord.
    • scheduler (optional): schedule:work.
    • nightwatch-agent (optional): the Laravel Nightwatch agent.
    • Environment variables are shared through an x-laravel-env anchor.
  • docker/supervisord.conf and docker/supervisor/queue-worker.conf, when queue workers are enabled.

Requirements

  • PHP 8.3+
  • Laravel 12 or 13
  • Front end (optional) managed by pnpm or npm. Projects using yarn or bun are rejected.

Installation

composer require --dev inisium/laravel-compose

Usage

Run the command and answer the prompts:

php artisan compose:install

Or run it non-interactively:

php artisan compose:install --no-interaction \
    --workers=4 \
    --extensions=gd --extensions=intl \
    --exclude-workspace=@acme/mobile \
    --force

Options

Option Default Description
--name APP_NAME from .env.example, else the directory name Application name, used as the APP_NAME and MAIL_FROM_NAME fallback.
--extensions=* bcmath, intl and every ext-* required in composer.json PHP extensions installed on top of the image ones. Built-in extensions are dropped.
--workers 4 Number of queue workers. 0 skips the queue service and supervisor.
--upload-max 30 Maximum uploaded file size, in MB (PHP and nginx limits).
--exclude-workspace=* none pnpm workspace (package name) excluded from the web build. Only its package.json is copied, so pnpm can validate the lockfile.
--without-scheduler scheduler on Do not generate the scheduler service.
--without-nightwatch on when laravel/nightwatch is required Do not generate the Nightwatch agent.
--without-s3 on when league/flysystem-aws-s3-v3 is required Do not declare the AWS_* variables.
--force off Overwrite existing files without confirmation.

What is detected

  • PHP version from the require.php constraint of composer.json (^8.4 → 8.4).
  • APP_NAME, APP_LOCALE and every VITE_* variable from .env.example. VITE_* variables become build args.
  • Package manager from the lockfile (pnpm-lock.yaml or package-lock.json), plus .npmrc.
  • pnpm workspaces from pnpm-workspace.yaml.

Customising the stubs

Publish the stubs:

php artisan vendor:publish --tag=compose-stubs

They land in stubs/compose/. Each file there takes precedence over the package one, file by file, so you can keep only the stubs you change.

Stubs are Blade templates rendered with Blade::render(). Use {!! !!} only: {{ }} would HTML-escape the output.

After generating

Add your application-specific environment variables to x-laravel-env in docker-compose.yaml: Coolify only forwards declared variables to the containers.

Testing

composer test

License

MIT. See LICENSE.md.