inisiatif/docker-tools

1.0.3 2025-08-01 15:16 UTC

This package is auto-updated.

Last update: 2025-08-01 15:17:41 UTC


README

๐Ÿงช Tests ๐Ÿณ Docker Tests ๐Ÿ” Code Quality ๐Ÿ”„ Compatibility Latest Stable Version Total Downloads License

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:

  1. Ask for your Docker Hub username
  2. Ask for your application name
  3. Publish all Docker configuration files
  4. 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 Dockerfile
  • docker/entrypoint.sh - Smart entrypoint script
  • docker/caddy/ - Caddy web server configurations
  • docker/php/ - PHP-FPM configurations
  • docker/supervisor/ - Supervisor configurations for multi-process containers

Docker Compose

  • docker-compose.yml - Development/production compose file
  • docker-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.