inisiatif / docker-tools
1.0.3
2025-08-01 15:16 UTC
Requires
- php: ^8.0
- illuminate/console: ^9.52.16|^10.0|^11.0|^12.0
- illuminate/contracts: ^9.52.16|^10.0|^11.0|^12.0
- illuminate/support: ^9.52.16|^10.0|^11.0|^12.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- orchestra/testbench: ^7.0|^8.0|^9.0|^10.0
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^9.0|^10.0|^11.0
README
A Laravel package that provides Docker tools and configurations for easy containerization of Laravel applications.
Features
- ๐ณ Multi-stage Dockerfile support for HTTP server, worker, and scheduler
- ๐ GitHub Workflows for automated building and deployment
- โ๏ธ Docker Compose configurations for development and production
- ๐ง Automatic placeholder replacement for Docker Hub username and app names
- ๐ฆ Easy publishing with
doctool:publish
command - ๐ฏ Support for multiple deployment modes (Docker Compose, Kubernetes)
- ๐ Built-in security with proper file permissions and configurations
Requirements
- PHP 8.0 or higher
- Laravel 9.x, 10.x, 11.x, or 12.x
- Docker (for using the generated configurations)
Installation
You can install the package via Composer:
composer require inisiatif/docker-tools
Usage
Publishing Docker Configurations
Use the doctool:publish
command to publish Docker configurations with automatic placeholder replacement:
php artisan doctool:publish
This command will:
- Ask for your Docker Hub username
- Ask for your application name
- Publish all Docker configuration files
- Replace placeholders with your actual values
Direct Publishing (Advanced)
If you want to publish raw configuration files without placeholder replacement:
# With confirmation prompt php artisan vendor:publish --tag=doctool-stubs # Skip confirmation (assumes you understand you're publishing raw files) php artisan vendor:publish --tag=doctool-stubs --force
Building Docker Images
Use the included build script to create Docker images:
# Basic build ./bin/doctool --app-name myapp --app-version v1.0.0 # Build with registry ./bin/doctool --registry docker.io/username --app-name myapp --app-version v1.0.0 # Build for Kubernetes ./bin/doctool --mode kubernetes --app-name myapp --app-version v1.0.0 # Show help ./bin/doctool --help
Published Files
The package publishes the following files:
Docker Configuration
docker/Dockerfile
- Multi-stage Dockerfiledocker/entrypoint.sh
- Smart entrypoint scriptdocker/caddy/
- Caddy web server configurationsdocker/php/
- PHP-FPM configurationsdocker/supervisor/
- Supervisor configurations for multi-process containers
Docker Compose
docker-compose.yml
- Development/production compose filedocker-compose.prod.yml
- Production-optimized compose file
GitHub Workflows
.github/workflows/build-images.yml
- Automated Docker image building.github/workflows/release.yml
- Release automation.github/release-drafter.yml
- Release drafter configuration
Configuration
Supported PHP Versions
- PHP 8.2
- PHP 8.3
Supported Deployment Modes
- Docker Compose: Traditional multi-container setup
- Kubernetes: Single-process containers with proper health checks
Image Types
- HTTP: Web server with Caddy + PHP-FPM
- Worker: Background job processing
- Scheduler: Cron job handling
Development
Running Tests
composer test
Test Coverage
composer test-coverage
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.