create-dockerfile-dev

Generate a Dockerfile for a PHP project development environment: builds an image that includes Xdebug, hot reload, and development tools to support local debugging and development.

Last repository push
GitHub Stars
109
Forks
26
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "create-dockerfile-dev" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-2438a0ebee43ef790e9bb66a68ebce140b6c5203f9de8aab257c907cec5863f2. Verify the upstream source and version against https://github.com/dykyi-roman/awesome-claude-code before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Generate a Dockerfile for a PHP project development environment: builds an image that includes Xdebug, hot reload, and development tools to support local debugging and development.

0 Downloads

Introduction source: third_party · dykyi-roman · 0.0.1 Reference

SkillPi interpretation

Tasks
Generates development Dockerfiles for PHP projects. Creates images with Xdebug, hot reload, and development tools.
Software, accounts and paid services
1. **Settings > PHP > Debug:** - Debug port: `9003` - Accept external connections: checked 2. **Settings > PHP > Servers:** - Name: `docker` - Host: `localhost` - Port: `80` - Debugger: Xdebug - Path mappings: `/path/to/project` -> `/app` 3. **Trigger debugging:** - Use browser extension (Xdebug Helper) - Or set cookie: `XDEBUG_TRIGGER=PHPSTORM`
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: create-dockerfile-dev
description: Generates development Dockerfiles for PHP projects. Creates images with Xdebug, hot reload, and development tools.

Development Dockerfile Generator

Generates development-optimized Dockerfiles for PHP projects with Xdebug integration, hot reload, and developer tools.

Generated Files

Dockerfile.dev            # Development image with debugging tools
docker-compose.dev.yml    # Development stack with volume mounts

Generation Instructions

  1. Analyze project:

    • Read composer.json for PHP version and extensions
    • Detect framework (Symfony/Laravel) for specific dev tools
    • Check for existing Docker configuration
  2. Generate Dockerfile.dev:

    • Single-stage (no multi-stage needed for dev)
    • Include Xdebug with full configuration
    • Include development tools (git, unzip, vim, curl)
    • Do NOT COPY source code (use volume mounts)
    • Use development PHP config (display_errors=On)
  3. Generate docker-compose.dev.yml:

    • Volume mount source code
    • Expose debug ports
    • Configure environment for IDE integration

Development Dockerfile

# Dockerfile.dev
# Development image with Xdebug and dev tools
# Do NOT use in production

FROM php:8.4-fpm-alpine

# Install system dependencies and dev tools
RUN apk add --no-cache \
    git \
    unzip \
    vim \
    curl \
    wget \
    bash \
    make \
    libzip-dev \
    icu-dev \
    linux-headers \
    postgresql-dev \
    libpng-dev \
    libjpeg-turbo-dev \
    freetype-dev \
    libwebp-dev \
    libxml2-dev \
    oniguruma-dev \
    rabbitmq-c-dev \
    $PHPIZE_DEPS

# Install PHP extensions
RUN docker-php-ext-configure gd \
        --with-freetype \
        --with-jpeg \
        --with-webp \
    && docker-php-ext-install -j$(nproc) \
        pdo_pgsql \
        pdo_mysql \
        intl \
        zip \
        opcache \
        gd \
        pcntl \
        bcmath \
        sockets \
        mbstring

# Install PECL extensions
RUN pecl install redis-6.1.0 \
    && pecl install amqp-2.1.2 \
    && docker-php-ext-enable redis amqp

# Install Xdebug
RUN pecl install xdebug-3.4.0 \
    && docker-php-ext-enable xdebug

# Install Composer
COPY --from=composer:2.8 /usr/bin/composer /usr/bin/composer

# Development PHP configuration
COPY <<'EOF' /usr/local/etc/php/conf.d/dev-php.ini
display_errors=On
display_startup_errors=On
error_reporting=E_ALL
log_errors=On
error_log=/proc/self/fd/2
memory_limit=512M
max_execution_time=0
max_input_time=-1
post_max_size=100M
upload_max_filesize=100M
realpath_cache_size=4096K
realpath_cache_ttl=600
session.use_strict_mode=1
EOF

# OPcache development configuration (validate on every request)
COPY <<'EOF' /usr/local/etc/php/conf.d/dev-opcache.ini
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.validate_timestamps=1
opcache.revalidate_freq=0
opcache.jit=disable
EOF

# Xdebug configuration
COPY <<'EOF' /usr/local/etc/php/conf.d/dev-xdebug.ini
[xdebug]
xdebug.mode=debug,coverage,develop
xdebug.client_host=host.docker.internal
xdebug.client_port=9003
xdebug.start_with_request=trigger
xdebug.discover_client_host=false
xdebug.idekey=PHPSTORM
xdebug.max_nesting_level=512
xdebug.var_display_max_depth=5
xdebug.var_display_max_data=512
xdebug.log=/tmp/xdebug.log
xdebug.log_level=3
EOF

# PHP-FPM development configuration
COPY <<'EOF' /usr/local/etc/php-fpm.d/zz-dev.conf
[www]
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 500
pm.status_path = /status
ping.path = /ping
access.log = /proc/self/fd/2
catch_workers_output = yes
decorate_workers_output = no
EOF

# Create development user matching host UID
ARG HOST_UID=1000
ARG HOST_GID=1000

RUN addgroup -g ${HOST_GID} dev \
    && adduser -u ${HOST_UID} -G dev -s /bin/bash -D dev \
    && mkdir -p /home/dev/.composer \
    && chown -R dev:dev /home/dev

WORKDIR /app

# Do NOT copy source code — use volume mounts instead
# Source is mounted via docker-compose.dev.yml

# Set ownership for working directory
RUN chown -R dev:dev /app

USER dev

# Composer cache in named volume
ENV COMPOSER_HOME=/home/dev/.composer

EXPOSE 9000

CMD ["php-fpm"]

Xdebug IDE Configuration

PhpStorm Setup

  1. Settings > PHP > Debug:

    • Debug port: 9003
    • Accept external connections: checked
  2. Settings > PHP > Servers:

    • Name: docker
    • Host: localhost
    • Port: 80
    • Debugger: Xdebug
    • Path mappings: /path/to/project -> /app
  3. Trigger debugging:

    • Use browser extension (Xdebug Helper)
    • Or set cookie: XDEBUG_TRIGGER=PHPSTORM

VS Code Setup

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "pathMappings": {
                "/app": "${workspaceFolder}"
            },
            "hostname": "0.0.0.0"
        }
    ]
}

Docker Compose Development Stack

# docker-compose.dev.yml
services:
  php:
    build:
      context: .
      dockerfile: Dockerfile.dev
      args:
        HOST_UID: ${HOST_UID:-1000}
        HOST_GID: ${HOST_GID:-1000}
    volumes:
      # Mount source code
      - .:/app:cached
      # Exclude vendor (use container's vendor)
      - vendor:/app/vendor
      # Composer cache
      - composer-cache:/home/dev/.composer
    environment:
      PHP_IDE_CONFIG: "serverName=docker"
      XDEBUG_MODE: "debug,coverage"
      XDEBUG_CONFIG: "client_host=host.docker.internal"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    ports:
      - "9003:9003"
    depends_on:
      - nginx

  nginx:
    image: nginx:1.27-alpine
    ports:
      - "8080:80"
    volumes:
      - .:/app:cached
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - php

volumes:
  vendor:
  composer-cache:

Useful Development Commands

# Build development image
docker compose -f docker-compose.dev.yml build

# Start development stack
docker compose -f docker-compose.dev.yml up -d

# Install dependencies inside container
docker compose -f docker-compose.dev.yml exec php composer install

# Run tests with coverage
docker compose -f docker-compose.dev.yml exec php vendor/bin/phpunit --coverage-html coverage

# Enable/disable Xdebug on-the-fly
docker compose -f docker-compose.dev.yml exec php bash -c \
    "echo 'xdebug.mode=off' > /usr/local/etc/php/conf.d/99-xdebug-toggle.ini && kill -USR2 1"

# PHP shell inside container
docker compose -f docker-compose.dev.yml exec php php -a

# Watch logs
docker compose -f docker-compose.dev.yml logs -f php

Hot Reload Notes

  • Source code is volume-mounted; changes reflect immediately
  • OPcache validate_timestamps=1 with revalidate_freq=0 detects file changes on every request
  • Xdebug start_with_request=trigger avoids debug overhead unless explicitly triggered
  • Vendor directory uses a named volume to avoid slow host filesystem I/O on macOS

Usage

Provide:

  • PHP version (default: 8.4)
  • Required extensions (from composer.json)
  • IDE (PhpStorm/VS Code) for Xdebug config
  • Host UID/GID for permission mapping

The generator will:

  1. Create Dockerfile.dev with all dev tools
  2. Configure Xdebug for your IDE
  3. Generate docker-compose.dev.yml with volume mounts
  4. Include helpful development commands

Current listing version

0.0.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value78/100

Highlights

  • 为 PHP 开发者提供开箱即用的开发环境 Dockerfile 生成能力,显著提升本地开发环境搭建效率
  • 集成 Xdebug、热重载和常用开发工具,覆盖主流 PHP 框架开发需求
Trigger Precision92/100

Highlights

  • 触发词精准覆盖 PHP 开发、Docker、Xdebug 等核心关键词,边界清晰,不易误触
Structure and Standards95/100

Highlights

  • 文档结构完整,包含生成步骤、完整配置示例、IDE 集成指南和实用命令,便于用户直接使用
Execution Reliability90/100

Highlights

  • 使用官方镜像和稳定版本,配置参数合理,覆盖开发环境常见优化和异常处理场景
Evidence Verifiability (mean of the first four)89/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

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

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

1. **Settings > PHP > Debug:** - Debug port: `9003` - Accept external connections: checked 2. **Settings > PHP > Servers:** - Name: `docker` - Host: `localhost` - Port: `80` - Debugger: Xdebug - Path mappings: `/path/to/project` -> `/app` 3. **Trigger debugging:** - Use browser extension (Xdebug Helper) - Or set cookie: `XDEBUG_TRIGGER=PHPSTORM`

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.