create-docker-makefile

为 PHP 项目生成包含常用命令的 Docker Makefile,创建构建、运行、测试和部署等目标。

仓库最近推送
GitHub Stars
109
Forks
26
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "create-docker-makefile":https://skillpi.com/zh/skills/deepskill-3efe4fc6f7fede09956a5ef49a877ec115a3f2dd77caa7b4edd153c421dd4ed0。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

为 PHP 项目生成包含常用命令的 Docker Makefile,创建构建、运行、测试和部署等目标。

0 下载

介绍来源: third_party · dykyi-roman · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: create-docker-makefile
description: Generates Docker Makefile with common commands for PHP projects. Creates build, run, test, and deployment targets.

Docker Makefile Generator

Generates a comprehensive Makefile for managing Docker-based PHP projects.

Generated Files

Makefile                    # Docker project management targets

Complete Makefile Template

# ──────────────────────────────────────────────────────────
# Docker Makefile for PHP Project
# Usage: make <target>
# ──────────────────────────────────────────────────────────

# ─── Variables ────────────────────────────────────────────
COMPOSE_FILE      ?= docker-compose.yml
COMPOSE_FILE_DEV  ?= docker-compose.dev.yml
COMPOSE_FILE_CI   ?= docker-compose.ci.yml
PHP_SERVICE       ?= php
NGINX_SERVICE     ?= nginx
DB_SERVICE        ?= mysql
REDIS_SERVICE     ?= redis
RABBITMQ_SERVICE  ?= rabbitmq
COMPOSE           = docker compose -f $(COMPOSE_FILE)
COMPOSE_DEV       = docker compose -f $(COMPOSE_FILE) -f $(COMPOSE_FILE_DEV)
COMPOSE_CI        = docker compose -f $(COMPOSE_FILE_CI)
PHP_EXEC          = $(COMPOSE) exec $(PHP_SERVICE)
PHP_RUN           = $(COMPOSE) run --rm $(PHP_SERVICE)
COMPOSER          = $(PHP_EXEC) composer

# ─── Colors ───────────────────────────────────────────────
GREEN  = \033[0;32m
YELLOW = \033[0;33m
CYAN   = \033[0;36m
RESET  = \033[0m

# ──────────────────────────────────────────────────────────
# BUILD
# ──────────────────────────────────────────────────────────
.PHONY: build build-dev build-ci build-no-cache

build: ## Build production images
    @echo "$(GREEN)Building production images...$(RESET)"
    $(COMPOSE) build

build-dev: ## Build development images
    @echo "$(GREEN)Building development images...$(RESET)"
    $(COMPOSE_DEV) build

build-ci: ## Build CI images
    @echo "$(GREEN)Building CI images...$(RESET)"
    $(COMPOSE_CI) build

build-no-cache: ## Build images without cache
    @echo "$(YELLOW)Building images without cache...$(RESET)"
    $(COMPOSE) build --no-cache

# ──────────────────────────────────────────────────────────
# LIFECYCLE
# ──────────────────────────────────────────────────────────
.PHONY: up up-dev down restart stop status logs

up: ## Start all services
    @echo "$(GREEN)Starting services...$(RESET)"
    $(COMPOSE) up -d

up-dev: ## Start services in development mode
    @echo "$(GREEN)Starting development services...$(RESET)"
    $(COMPOSE_DEV) up -d

down: ## Stop and remove containers, networks
    @echo "$(YELLOW)Stopping services...$(RESET)"
    $(COMPOSE) down

restart: down up ## Restart all services

stop: ## Stop services without removing
    $(COMPOSE) stop

status: ## Show running containers and their status
    @echo "$(CYAN)Container status:$(RESET)"
    $(COMPOSE) ps

logs: ## Show logs from all services
    $(COMPOSE) logs -f --tail=100

logs-php: ## Show PHP service logs
    $(COMPOSE) logs -f --tail=100 $(PHP_SERVICE)

logs-nginx: ## Show Nginx service logs
    $(COMPOSE) logs -f --tail=100 $(NGINX_SERVICE)

# ──────────────────────────────────────────────────────────
# SHELL ACCESS
# ──────────────────────────────────────────────────────────
.PHONY: shell shell-root shell-db shell-redis

shell: ## Open shell in PHP container
    $(PHP_EXEC) sh

shell-root: ## Open root shell in PHP container
    $(COMPOSE) exec -u root $(PHP_SERVICE) sh

shell-db: ## Open database CLI
    $(COMPOSE) exec $(DB_SERVICE) mysql -u root -p

shell-redis: ## Open Redis CLI
    $(COMPOSE) exec $(REDIS_SERVICE) redis-cli

# ──────────────────────────────────────────────────────────
# TESTING
# ──────────────────────────────────────────────────────────
.PHONY: test test-unit test-integration test-coverage test-ci

test: ## Run all tests
    @echo "$(GREEN)Running tests...$(RESET)"
    $(PHP_EXEC) vendor/bin/phpunit

test-unit: ## Run unit tests only
    @echo "$(GREEN)Running unit tests...$(RESET)"
    $(PHP_EXEC) vendor/bin/phpunit --group=unit

test-integration: ## Run integration tests only
    @echo "$(GREEN)Running integration tests...$(RESET)"
    $(PHP_EXEC) vendor/bin/phpunit --group=integration

test-coverage: ## Run tests with coverage report
    @echo "$(GREEN)Running tests with coverage...$(RESET)"
    $(PHP_EXEC) vendor/bin/phpunit --coverage-html=coverage --coverage-clover=coverage/clover.xml

test-ci: build-ci ## Run tests in CI environment
    @echo "$(GREEN)Running CI tests...$(RESET)"
    $(COMPOSE_CI) run --rm app vendor/bin/phpunit --coverage-clover=coverage/clover.xml

# ──────────────────────────────────────────────────────────
# STATIC ANALYSIS & LINTING
# ──────────────────────────────────────────────────────────
.PHONY: lint phpstan cs-fix cs-check psalm

lint: phpstan cs-check ## Run all linters

phpstan: ## Run PHPStan static analysis
    @echo "$(GREEN)Running PHPStan...$(RESET)"
    $(PHP_EXEC) vendor/bin/phpstan analyse --memory-limit=512M

cs-fix: ## Fix code style with PHP CS Fixer
    @echo "$(GREEN)Fixing code style...$(RESET)"
    $(PHP_EXEC) vendor/bin/php-cs-fixer fix

cs-check: ## Check code style (dry-run)
    @echo "$(GREEN)Checking code style...$(RESET)"
    $(PHP_EXEC) vendor/bin/php-cs-fixer fix --dry-run --diff

psalm: ## Run Psalm type checker
    @echo "$(GREEN)Running Psalm...$(RESET)"
    $(PHP_EXEC) vendor/bin/psalm --show-info=true

# ──────────────────────────────────────────────────────────
# DATABASE
# ──────────────────────────────────────────────────────────
.PHONY: db-migrate db-migrate-down db-seed db-reset db-diff

db-migrate: ## Run database migrations
    @echo "$(GREEN)Running migrations...$(RESET)"
    $(PHP_EXEC) php bin/console doctrine:migrations:migrate --no-interaction

db-migrate-down: ## Rollback last migration
    @echo "$(YELLOW)Rolling back last migration...$(RESET)"
    $(PHP_EXEC) php bin/console doctrine:migrations:migrate prev --no-interaction

db-seed: ## Seed database with fixtures
    @echo "$(GREEN)Seeding database...$(RESET)"
    $(PHP_EXEC) php bin/console doctrine:fixtures:load --no-interaction

db-reset: ## Drop, create and migrate database
    @echo "$(YELLOW)Resetting database...$(RESET)"
    $(PHP_EXEC) php bin/console doctrine:database:drop --force --if-exists
    $(PHP_EXEC) php bin/console doctrine:database:create
    $(PHP_EXEC) php bin/console doctrine:migrations:migrate --no-interaction

db-diff: ## Generate migration from entity changes
    $(PHP_EXEC) php bin/console doctrine:migrations:diff

# ──────────────────────────────────────────────────────────
# CACHE
# ──────────────────────────────────────────────────────────
.PHONY: cache-clear cache-warmup

cache-clear: ## Clear application cache
    @echo "$(GREEN)Clearing cache...$(RESET)"
    $(PHP_EXEC) php bin/console cache:clear

cache-warmup: ## Warmup application cache
    @echo "$(GREEN)Warming up cache...$(RESET)"
    $(PHP_EXEC) php bin/console cache:warmup

# ──────────────────────────────────────────────────────────
# COMPOSER
# ──────────────────────────────────────────────────────────
.PHONY: composer-install composer-update composer-require composer-dump

composer-install: ## Install Composer dependencies
    @echo "$(GREEN)Installing dependencies...$(RESET)"
    $(COMPOSER) install

composer-update: ## Update Composer dependencies
    @echo "$(YELLOW)Updating dependencies...$(RESET)"
    $(COMPOSER) update

composer-require: ## Add a new dependency (usage: make composer-require PACKAGE=vendor/package)
    $(COMPOSER) require $(PACKAGE)

composer-dump: ## Regenerate autoloader
    $(COMPOSER) dump-autoload --optimize

# ──────────────────────────────────────────────────────────
# DOCKER CLEANUP
# ──────────────────────────────────────────────────────────
.PHONY: docker-clean docker-prune docker-volumes-clean

docker-clean: down ## Remove containers, images, and volumes for this project
    @echo "$(YELLOW)Cleaning project Docker resources...$(RESET)"
    $(COMPOSE) down --rmi local --volumes --remove-orphans

docker-prune: ## Remove all unused Docker resources (system-wide)
    @echo "$(YELLOW)Pruning unused Docker resources...$(RESET)"
    docker system prune -f
    docker volume prune -f

docker-volumes-clean: ## Remove project volumes
    @echo "$(YELLOW)Removing project volumes...$(RESET)"
    $(COMPOSE) down --volumes

# ──────────────────────────────────────────────────────────
# HELP
# ──────────────────────────────────────────────────────────
.PHONY: help
.DEFAULT_GOAL := help

help: ## Show this help message
    @echo "$(CYAN)Available targets:$(RESET)"
    @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
        awk 'BEGIN {FS = ":.*?## "}; {printf "  $(GREEN)%-22s$(RESET) %s\n", $$1, $$2}'

Generation Instructions

  1. Detect project setup:

    • Check for existing docker-compose files
    • Identify service names (PHP, Nginx, DB, Redis)
    • Detect framework (Symfony/Laravel) for correct CLI commands
  2. Customize targets:

    • Adapt database commands for framework (Doctrine/Eloquent)
    • Adapt cache commands for framework
    • Add project-specific services
  3. Set variables:

    • Match COMPOSE_FILE to actual filenames
    • Match service names to docker-compose service names
    • Adjust PHP_EXEC for service name
  4. Validate:

    • Ensure all referenced compose files exist
    • Verify service names match
    • Test each target works

Usage

Provide:

  • Framework (Symfony/Laravel)
  • Docker Compose file names
  • Service names
  • Additional custom targets needed

The generator will:

  1. Create Makefile with all standard targets
  2. Adapt commands for the detected framework
  3. Include proper .PHONY declarations
  4. Add auto-generated help target

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 为 PHP 开发者提供实用的 Docker 项目管理工具
  • 覆盖构建、运行、测试、部署等完整开发生命周期
  • 显著提升 Docker 化 PHP 项目的开发效率
触发精准88/100

亮点

  • 触发词精准覆盖 Docker Makefile 生成场景
  • 明确限定 PHP 项目范围,边界清晰
  • description 位置正确且内容完整
结构规范92/100

待提升项

  • 文档长度 原报告严重程度:轻微

    Makefile 模板内容较长,可能影响阅读体验

    改进建议:可考虑将完整模板移至单独文件,主文档保留核心说明

亮点

  • 结构清晰,包含完整模板、生成说明和使用指南
  • frontmatter 完整规范
  • 提供详细的生成步骤和自定义说明
执行可靠90/100

亮点

  • 工具来源明确,使用标准 Docker 和 PHP 工具链
  • 变量定义清晰,支持多环境配置
  • 包含完整的 .PHONY 声明和 help 目标
  • 覆盖开发、生产、CI 等多种使用场景
证据可验 (前四项均值)89/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。