zero-to-prod/dock 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zero-to-prod/dock

最新稳定版本:v1.2.0

Composer 安装命令:

composer require zero-to-prod/dock

包简介

Docker files for running a basic PHP application.

README 文档

README

Repo Packagist Downloads Packagist Version GitHub repo size License Hits-of-Code wakatime

Contents

Introduction

Dock provides a Docker powered local development experience for a PHP application. Other than Docker, no software or libraries are required to be installed on your local computer before using Dock. Dock's simple CLI means you can start building your PHP application without any previous Docker experience.

Why you’ll love it:

  • Test Multiple PHP Versions with one script.
  • Switch Versions Easily via .env settings.
  • Comprehensive Docker Support through docker-compose.
  • PHP Debugging already setup across all supported versions.
  • Available with Composer.

Supported PHP Versions

Compatible with PHP:

  • 7.1
  • 7.2
  • 7.3
  • 7.4
  • 8.0
  • 8.1
  • 8.2
  • 8.3
  • 8.4
  • 8.5

Prerequisites

  • Docker installed and running

Installation

Add dock to your project with Composer:

composer require zero-to-prod/dock --dev

Documentation Publishing

You can publish this README to your local documentation directory.

This can be useful for providing documentation for AI agents.

This can be done using the included script:

# Publish to default location (./docs/zero-to-prod/dock)
vendor/bin/zero-to-prod-dock

# Publish to custom directory
vendor/bin/zero-to-prod-dock /path/to/your/docs

Automatic Documentation Publishing

You can automatically publish documentation by adding the following to your composer.json:

{
    "scripts": {
        "post-install-cmd": [
            "zero-to-prod-dock"
        ],
        "post-update-cmd": [
            "zero-to-prod-dock"
        ]
    }
}

Initialization

Once you have the composer package installed, you can set up Dock in your project directory:

./vendor/bin/dock

This copies necessary configuration files to your project.

Usage

Dock includes scripts to build and manage your PHP environments effortlessly.

Configuration

Before starting development, verify that your .env file contains the correct settings.

You can specify which PHP version to use for local development, debugging, and Composer operations by updating these variables in your .env file:

PHP_VERSION=8.1
PHP_DEBUG=8.1
PHP_COMPOSER=8.1

Building Containers

Build Docker containers based on your .env PHP versions:

sh dock build

This will create the following containers:

  • php<PHP_VERSION> (example service: php7.1)
  • debug<PHP_VERSION> (example service: debug7.1)
  • composer<PHP_VERSION> (example service: composer7.1)

Install Dependencies for a Runtime

Update Composer dependencies as defined in your .env:

sh dock composer update

Commands

There a few commands that come with the default script.

sh dock build      # Builds the php, debug, and composer containers
sh dock init       # Initialize the .env file from .env.example if it doesn't exist.
sh dock test       # Run PHPUnit tests using the specified PHP version.
sh dock composer   # Run Composer commands using the specified PHP version.
sh dock <service>  # Run a specified Docker service with optional arguments.

统计信息

  • 总下载量: 2.85k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: Dockerfile

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-06