PHPackages                             inisiatif/docker-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. inisiatif/docker-tools

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

inisiatif/docker-tools
======================

v2.0.1(7mo ago)01.8k↑150%MITPHPPHP ^8.0CI failing

Since Aug 1Pushed 7mo agoCompare

[ Source](https://github.com/atInisiatifZakat/docker-tools)[ Packagist](https://packagist.org/packages/inisiatif/docker-tools)[ RSS](/packages/inisiatif-docker-tools/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (7)Versions (8)Used By (0)

Docker Tools
============

[](#docker-tools)

A comprehensive Docker toolkit for building and deploying Laravel applications with support for multiple PHP versions and deployment environments.

Features
--------

[](#features)

- **Multi-stage Docker builds** with HTTP and Artisan stages
- **PHP versions support**: 8.1, 8.2, 8.3, 8.4
- **Simple CMD override pattern** for maximum flexibility
- **Environment compatibility**: VM environments (EC2, Droplets) and cluster environments (K8s, Nomad)
- **Semantic versioning** with automated build and push
- **Zero-complexity deployment** with no environment variables required

Quick Start
-----------

[](#quick-start)

### 1. Install the Package

[](#1-install-the-package)

```
composer require inisiatif/docker-tools
```

### 2. Publish Docker Files

[](#2-publish-docker-files)

```
php artisan doctool:publish
```

This creates:

- `docker/` directory with Dockerfile and configurations
- `docker-compose.yml` for development
- `docker-compose.prod.yml` for production

### 3. Build Images

[](#3-build-images)

```
# Build with default settings (PHP 8.3)
./bin/doctool

# Build with specific PHP version
./bin/doctool --php-version 8.4

# Build and push to registry
./bin/doctool --push myregistry/myapp

# Build with semantic versioning
./bin/doctool --push myregistry/myapp --version 1.2.3
```

Usage Examples
--------------

[](#usage-examples)

### Quick Start

[](#quick-start-1)

```
# HTTP Server
docker run -p 8080:8080 myapp:http-php8.3

# Queue Worker
docker run myapp:artisan-php8.3 php artisan queue:work --verbose --tries=3

# Scheduler
docker run myapp:artisan-php8.3 php artisan schedule:work

# Any Custom Command
docker run myapp:artisan-php8.3 php artisan migrate --force
```

📋 **For complete deployment examples see**: [examples/](examples/)

- [Docker Run Commands](examples/docker-run.md) - Single server deployment
- [Docker Compose](examples/docker-compose.md) - VM environments (EC2, Droplets)
- [Kubernetes](examples/kubernetes.md) - Cloud-native deployments
- [Nomad](examples/nomad.md) - HashiCorp stack deployments

Docker Images
-------------

[](#docker-images)

The toolkit builds two types of images:

### HTTP Image (`myapp:http-php8.3`)

[](#http-image-myapphttp-php83)

- **Purpose**: Web server with PHP-FPM + Caddy
- **Entrypoint**: Automatically starts HTTP services
- **Use cases**: Web requests, API endpoints
- **Port**: 8080

### Artisan Image (`myapp:artisan-php8.3`)

[](#artisan-image-myappartisan-php83)

- **Purpose**: CLI operations and background tasks
- **Entrypoint**: Pure command execution via CMD override
- **Use cases**: Queue workers, schedulers, migrations, custom commands
- **Port**: None (CLI only)

Build Tool (`bin/doctool`)
--------------------------

[](#build-tool-bindoctool)

The build script provides semantic versioning and registry management:

```
Usage: ./bin/doctool [OPTIONS]

Options:
  --php-version VERSION    PHP version to use (8.1, 8.2, 8.3, 8.4)
                          Default: 8.3

  --app-name NAME         Application name for image prefix
                          Default: current directory name

  --push REGISTRY         Build and push to registry
                          Example: --push myregistry/myapp

  --version VERSION       Semantic version (major.minor.patch)
                          Example: --version 1.2.3
                          Auto-generates: latest, 1.2.3, 1.2, 1

  --help                  Show this help message

Examples:
  ./bin/doctool                                    # Build locally
  ./bin/doctool --php-version 8.4                 # Build with PHP 8.4
  ./bin/doctool --push myregistry/myapp            # Build and push
  ## PHP Version Support

All major PHP versions are supported with version-specific optimizations:

- **PHP 8.1**: Stable LTS with proven compatibility
- **PHP 8.2**: Performance improvements and new features
- **PHP 8.3**: Latest stable with enhanced performance
- **PHP 8.4**: Cutting-edge features and optimizations

Each version includes:
- Optimized PHP-FPM configuration
- Version-specific extensions
- Performance tuning for container environments

## Environment Compatibility

### VM Environments
- **AWS EC2**: Full support with Docker and Docker Compose
- **DigitalOcean Droplets**: Native Docker support
- **Azure VMs**: Compatible with container runtimes
- **Google Compute Engine**: Works with Docker and containerd
- **On-premises VMs**: Any Linux distribution with Docker

### Cluster Environments
- **Kubernetes**: Native support with health checks and resource management
- **Nomad**: Full job specification support
- **Docker Swarm**: Service deployment and scaling
- **Amazon ECS**: Task definitions and service management
- **Azure Container Instances**: Direct container deployment

## Testing Compatibility

Run the comprehensive compatibility test:

```bash
# Build images first
./bin/doctool

# Run compatibility tests
./test-compatibility.sh
```

Tests cover:

- Direct Docker run commands
- Docker Compose scenarios
- Kubernetes simulation
- Multi-PHP version support
- Environment variable handling

File Structure
--------------

[](#file-structure)

After running `php artisan docker:publish`:

```
project/
├── docker/
│   ├── Dockerfile              # Multi-stage build definition
│   ├── entrypoint.sh          # Simple service detection
│   ├── caddy/
│   │   └── 8.x/
│   │       └── Caddyfile      # Web server configuration
│   └── php/
│       ├── opcache.ini        # PHP optimization
│       ├── php.ini           # PHP configuration
│       └── 8.x/
│           └── php-fpm.conf  # PHP-FPM pool configuration
├── docker-compose.yml         # Development composition
├── docker-compose.prod.yml    # Production composition
├── bin/
│   └── doctool               # Build and deployment script
└── examples/
    ├── README.md            # Deployment examples index
    ├── docker-run.md        # Direct Docker run commands
    ├── docker-compose.md    # Docker Compose for VMs
    ├── kubernetes.md        # Kubernetes manifests
    └── nomad.md             # Nomad job specifications

```

Configuration
-------------

[](#configuration)

The images support standard Laravel environment variables and PHP customizations.

📋 **For detailed configuration examples see**: [examples/](examples/)

### Key Environment Variables

[](#key-environment-variables)

```
# Essential Laravel settings
APP_ENV=production
APP_KEY=base64:your-key-here
DB_HOST=database
DB_DATABASE=laravel
QUEUE_CONNECTION=redis
REDIS_HOST=redis

# PHP optimizations
PHP_MEMORY_LIMIT=512M
PHP_OPCACHE_ENABLE=1
```

Best Practices
--------------

[](#best-practices)

1. **Use specific versions**: Always tag with semantic versions
2. **Resource limits**: Set appropriate CPU and memory limits
3. **Health checks**: Implement proper liveness and readiness probes
4. **Single scheduler**: Only run one scheduler instance
5. **Monitoring**: Use proper logging and monitoring for production

Troubleshooting
---------------

[](#troubleshooting)

### Quick Debugging

[](#quick-debugging)

```
# Check logs
docker logs

# Interactive debugging
docker run -it myapp:artisan-php8.3 bash

# Test health endpoint
curl http://localhost:8080/up
```

📋 **For detailed troubleshooting see**: [examples/](examples/)

### Getting Help

[](#getting-help)

1. Check the [deployment examples](examples/) for your target platform
2. Run the compatibility test script: `./test-compatibility.sh`
3. Review Docker logs for error messages
4. Verify environment variables are set correctly

Contributing
------------

[](#contributing)

1. Fork the repository
2. Create a feature branch
3. Add tests for new functionality
4. Ensure all tests pass
5. Submit a pull request

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance62

Regular maintenance activity

Popularity20

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Total

7

Last Release

238d ago

Major Versions

1.x-dev → v2.0.02025-08-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/3500d4ed2061891d54f54b550fbb9e782d0d1838b7fee429578a0733b0a378bf?d=identicon)[NoorAdiana](/maintainers/NoorAdiana)

---

Top Contributors

[![nuradiyana](https://avatars.githubusercontent.com/u/1073802?v=4)](https://github.com/nuradiyana "nuradiyana (12 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/inisiatif-docker-tools/health.svg)

```
[![Health](https://phpackages.com/badges/inisiatif-docker-tools/health.svg)](https://phpackages.com/packages/inisiatif-docker-tools)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[illuminate/pipeline

The Illuminate Pipeline package.

9346.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)[napp/xray-laravel

AWS X-Ray for Laravel applications.

61407.3k](/packages/napp-xray-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
