{"id":31518928,"url":"https://github.com/exaco/laravel-docktane","last_synced_at":"2025-10-03T09:03:07.413Z","repository":{"id":40552744,"uuid":"384944403","full_name":"exaco/laravel-docktane","owner":"exaco","description":"Production-ready Docker setup for Laravel Octane (FrankenPHP, Swoole, RoadRunner) powered web services and microservices. Done right.","archived":false,"fork":false,"pushed_at":"2025-09-30T20:12:18.000Z","size":373,"stargazers_count":862,"open_issues_count":10,"forks_count":125,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-09-30T21:08:02.774Z","etag":null,"topics":["docker","docker-compose","dockerfile","frankenphp","horizon","laravel","microservice","octane","reverb","roadrunner","swoole"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exaco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-07-11T12:38:28.000Z","updated_at":"2025-09-30T20:12:20.000Z","dependencies_parsed_at":"2023-10-14T18:08:23.745Z","dependency_job_id":"77745906-1cf0-4c37-9505-d4454e354620","html_url":"https://github.com/exaco/laravel-docktane","commit_stats":null,"previous_names":["exaco/laravel-docktane"],"tags_count":25,"template":true,"template_full_name":null,"purl":"pkg:github/exaco/laravel-docktane","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exaco%2Flaravel-docktane","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exaco%2Flaravel-docktane/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exaco%2Flaravel-docktane/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exaco%2Flaravel-docktane/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exaco","download_url":"https://codeload.github.com/exaco/laravel-docktane/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exaco%2Flaravel-docktane/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278136401,"owners_count":25935917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","dockerfile","frankenphp","horizon","laravel","microservice","octane","reverb","roadrunner","swoole"],"created_at":"2025-10-03T09:01:27.633Z","updated_at":"2025-10-03T09:03:07.407Z","avatar_url":"https://github.com/exaco.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n \u003ch1\u003eLaravel Docker Setup\u003c/h1\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n \u003ca href=\"/LICENSE\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/exaco/laravel-octane-dockerfile\"\u003e\u003c/a\u003e\n \u003ca href=\"https://github.com/exaco/laravel-octane-dockerfile/releases\"\u003e\u003cimg alt=\"GitHub release (latest by date)\" src=\"https://img.shields.io/github/v/release/exaco/laravel-octane-dockerfile\"\u003e\u003c/a\u003e\n \u003ca href=\"https://github.com/exaco/laravel-octane-dockerfile/pulls\"\u003e\u003cimg alt=\"GitHub closed pull requests\" src=\"https://img.shields.io/github/issues-pr-closed/exaco/laravel-octane-dockerfile\"\u003e\u003c/a\u003e\n \u003cbr\u003e\n \u003ca href=\"https://github.com/exaco/laravel-octane-dockerfile/actions/workflows/tests.yml\"\u003e\u003cimg alt=\"GitHub Workflow Status\" src=\"https://github.com/exaco/laravel-octane-dockerfile/actions/workflows/roadrunner-test.yml/badge.svg\"\u003e\u003c/a\u003e\n \u003ca href=\"https://github.com/exaco/laravel-octane-dockerfile/actions/workflows/tests.yml\"\u003e\u003cimg alt=\"GitHub Workflow Status\" src=\"https://github.com/exaco/laravel-octane-dockerfile/actions/workflows/swoole-test.yml/badge.svg\"\u003e\u003c/a\u003e\n \u003ca href=\"https://github.com/exaco/laravel-octane-dockerfile/actions/workflows/tests.yml\"\u003e\u003cimg alt=\"GitHub Workflow Status\" src=\"https://github.com/exaco/laravel-octane-dockerfile/actions/workflows/frankenphp-test.yml/badge.svg\"\u003e\u003c/a\u003e\n \u003ca href=\"https://github.com/exaco/laravel-octane-dockerfile/actions/workflows/tests.yml\"\u003e\u003cimg alt=\"GitHub Workflow Status\" src=\"https://github.com/exaco/laravel-octane-dockerfile/actions/workflows/compose-test.yaml/badge.svg\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\nA production-ready Docker setup for running high-performance Laravel applications with Laravel Octane. This repository provides Dockerfiles and a comprehensive Docker Compose configuration for various Octane drivers, including Swoole, RoadRunner, and FrankenPHP.\n\nThe setup is optimized for performance and includes multi-stage builds to create lean final images.\n\n## Key Features\n\n- **Multiple Drivers:** Dockerfiles available for Swoole, RoadRunner, and FrankenPHP.\n- **Production-Ready:** Optimized for a production environment with best practices.\n- **Multi-Stage Builds:** Creates smaller, more secure Docker images by separating build dependencies from the final runtime image.\n- **Container Modes:** Easily run your container in different modes for handling web requests (`http`), queues (`horizon`), scheduled tasks (`scheduler`), custom worker (`worker`), or WebSocket server (`reverb`).\n- **Extensible:** Simple to customize for your specific application needs.\n- **Comprehensive Docker Compose:** Includes a production-ready `compose.production.yaml` to orchestrate the full application stack.\n\n\n## Laravel Container modes\n\nEasily launch your container in different modes to handle specific tasks:\n\n\n| Mode                  | `CONTAINER_MODE` value | Description\n| --------------------- | ---------------- | ---------------- |\n| HTTP Server (default) | `http` | Runs your Laravel Octane application.        |\n| Horizon               | `horizon`        | Manages your queued jobs efficiently.        |\n| Scheduler             | `scheduler`      | Executes scheduled tasks at defined intervals.        |\n| Worker                | `worker`         | A dedicated worker for background processing.        |\n| Reverb                | `reverb`         | Facilitates real-time communication with Laravel Echo.        |\n\n## Production-Ready Docker Compose\n\nFor a complete production environment, this repository includes a `compose.production.yaml` file to orchestrate a full stack of services. This setup is security-hardened and provides a comprehensive solution for deploying and managing your application.\n\nThe orchestrated containers include:\n\n- **Application:** Your Laravel Octane application running in http mode to serve web requests.\n- **Horizon:** A dedicated container for running Laravel Horizon to manage your Redis queues.\n- **Scheduler:** A container responsible for executing Laravel's scheduled tasks. \n- **Database:** A PostgreSQL container for your application's database.\n- **PgBouncer:** Lightweight connection pooler for PostgreSQL.\n- **Redis:** An in-memory data store used for caching and as a message broker for Laravel Horizon.\n- **Minio:** An S3-compatible object storage service, perfect for handling file uploads and storage.\n- **Typesense:** A fast, typo-tolerant, and open-source search engine for building powerful search functionality into your application.\n- **pgAdmin \u0026 pghero:** Web-based tools for managing your PostgreSQL database and monitoring its performance.\n- **Backup Service:** A container that performs automated backups of your database to ensure data safety.\n- **System Monitoring:** Includes Netdata containers to provide real-time insights and monitoring for your entire infrastructure.\n- **Prometheus:** A powerful time-series database used for collecting metrics from your application and the host system.\n- **Grafana:** A leading open-source platform for monitoring and observability, used to visualize the metrics collected by Prometheus in beautiful dashboards.\n\nThis comprehensive stack provides a robust and observable environment for your production application.\n\n## Prerequisites\n\n- Docker installed on your system\n- Docker Compose installed on your system\n- Setup Laravel Octane, Laravel Horizon and Laravel Reverb\n\n## Usage\n\n### Building Docker image\n\n1. Clone the repository:\n```\ngit clone --depth 1 git@github.com:exaco/laravel-octane-dockerfile.git\n```\n2. Copy the contents of the cloned directory, including the following items, into your Laravel project powered by Octane:\n   - `deployment` directory\n   - `\u003cyour-octane-driver\u003e.Dockerfile`\n   - `.dockerignore` \n    \n1. Change the directory to your Laravel project\n2. Build your image:\n```\ndocker build -t \u003cimage-name\u003e:\u003ctag\u003e -f \u003cyour-octane-driver\u003e.Dockerfile .\n```\n\n### Running Docker container\n\n```bash\n# HTTP mode\ndocker run -p \u003cport\u003e:8000 --rm \u003cimage-name\u003e:\u003ctag\u003e\n\n# Horizon mode\ndocker run -e CONTAINER_MODE=horizon --rm \u003cimage-name\u003e:\u003ctag\u003e\n\n# Scheduler mode\ndocker run -e CONTAINER_MODE=scheduler --rm \u003cimage-name\u003e:\u003ctag\u003e\n\n# Reverb mode\ndocker run -e CONTAINER_MODE=reverb --rm \u003cimage-name\u003e:\u003ctag\u003e\n\n# HTTP mode with Horizon\ndocker run -e WITH_HORIZON=true -p \u003cport\u003e:8000 --rm \u003cimage-name\u003e:\u003ctag\u003e\n\n# HTTP mode with Scheduler\ndocker run -e WITH_SCHEDULER=true -p \u003cport\u003e:8000 --rm \u003cimage-name\u003e:\u003ctag\u003e\n\n# HTTP mode with Scheduler and Horizon\ndocker run \\\n    -e WITH_SCHEDULER=true \\\n    -e WITH_HORIZON=true \\\n    -p \u003cport\u003e:8000 \\\n    --rm \u003cimage-name\u003e:\u003ctag\u003e\n\n# HTTP mode with Scheduler, Horizon and Reverb\ndocker run \\\n    -e WITH_SCHEDULER=true \\\n    -e WITH_HORIZON=true \\\n    -e WITH_REVERB=true \\\n    -p \u003cport\u003e:8000 \\\n    --rm \u003cimage-name\u003e:\u003ctag\u003e\n\n# Worker mode\ndocker run \\\n    -e CONTAINER_MODE=worker \\\n    -e WORKER_COMMAND=\"php /var/www/html/artisan foo:bar\" \\\n    --rm \u003cimage-name\u003e:\u003ctag\u003e\n\n# Running a single command\ndocker run --rm \u003cimage-name\u003e:\u003ctag\u003e php artisan about\n```\n\n### Docker Compose\n\nTo deploy your application stack with Docker Compose:\n1. Copy the following items to your code base:\n    - `compose.production.yaml`\n    - `.env.production`\n    - `Makefile`\n2. Edit `.env.production` and populate it with the appropriate values for your production environment variables (e.g., database credentials, API keys).\n3. Run the following command in your project root directory to prevent permission issues:\n```bash\nsudo mkdir -p storage/framework/{sessions,views,cache,testing} storage/logs \u0026\u0026 sudo chmod -R a+rw storage\n```\n4. Run the command `make up` to start the containers.\n\n\u003e [!NOTE]  \n\u003e The included `Makefile` offers a range of additional commands for managing your deployment, including options for rebuilding, stopping, and restarting services.\n\n\u003e [!CAUTION]\n\u003e Do not forget to edit `.env.production`!\n\n## Configuration and Customization\n\n* You can use the `APP_ENV` build argument to specify a different environment file.\n\n### Recommended `Swoole` options in `octane.php`\n\n```php\n// config/octane.php\n\nreturn [\n    'swoole' =\u003e [\n        'options' =\u003e [\n            'http_compression' =\u003e true,\n            'http_compression_level' =\u003e 6, // 1 - 9\n            'compression_min_length' =\u003e 20,\n            'package_max_length' =\u003e 2 * 1024 * 1024, // 2MB\n            'upload_max_filesize' =\u003e 20 * 1024 * 1024, // 20MB\n            'open_http2_protocol' =\u003e true,\n            'document_root' =\u003e public_path(),\n            'enable_static_handler' =\u003e true,\n        ]\n    ]\n];\n```\n\n## Essential Notes\n\n* Some configurations are highly opinionated, so please make sure they align with your needs.\n* Laravel Octane logs request information only in the `local` environment.\n* Be mindful of the contents of the `.dockerignore` file.\n\n## ToDo\n- [x] Add Docker Compose\n- [x] Add support for PHP 8.4\n- [x] Add support for worker mode\n- [x] Build assets with Bun\n- [x] Install more Caddy modules\n- [x] Create standalone and self-executable app\n- [x] Add support for Horizon\n- [x] Add support for RoadRunner\n- [x] Add support for FrankenPHP\n- [x] Add support for Laravel Reverb\n- [x] Add support for the full-stack apps (Front-end assets)\n- [ ] Add support `testing` environment and CI\n- [x] Add support for the Laravel scheduler\n- [ ] Add support for Laravel Dusk\n- [x] Support more PHP extensions\n- [x] Add tests\n- [x] Add Alpine-based images\n\n## Contributing\n\nThank you for considering contributing! If you find an issue, or have a better way to do something, feel free to open an\nissue, or a PR.\n\n## Credits\n\n- [SMortexa](https://github.com/smortexa)\n- [All contributors](https://github.com/exaco/laravel-octane-dockerfile/graphs/contributors)\n\n## License\n\nThis repository is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexaco%2Flaravel-docktane","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexaco%2Flaravel-docktane","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexaco%2Flaravel-docktane/lists"}