/acc:analyze-docker-image-sizefrom acc
Analyzes Docker image size for PHP projects, identifying bloated layers and unnecessary packages, and provides size reduction strategies.
Ships in acc. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Analyze Docker images for PHP projects to identify bloat sources and provide size reduction strategies.
| Base Image | Minimal | Typical | Bloated |
|---|---|---|---|
| php:8.4-fpm-alpine | 30-50 MB | 80-120 MB | 200+ MB |
| php:8.4-fpm (Debian) | 150-200 MB | 250-350 MB | 500+ MB |
| php:8.4-cli-alpine | 25-40 MB | 60-100 MB | 180+ MB |
# BLOATED: Dev packages remain in final image
RUN apk add --no-cache $PHPIZE_DEPS icu-dev libzip-dev \
&& docker-php-ext-install intl zip
# OPTIMIZED: Remove build deps after compilation
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS icu-dev libzip-dev \
&& docker-php-ext-install intl zip \
&& apk del .build-deps \
&& apk add --no-cache icu-libs libzip
# BLOATED: Includes dev dependencies (+30-80MB)
RUN composer install
# OPTIMIZED: No dev dependencies, optimized autoloader
RUN composer install --no-dev --no-scripts --prefer-dist --optimize-autoloader
# BLOATED: Full Debian base (~150MB base)
FROM php:8.4-fpm
# OPTIMIZED: Alpine base (~30MB base)
FROM php:8.4-fpm-alpine
# BLOATED: apt cache retained (~30-50MB)
RUN apt-get update && apt-get install -y libicu-dev
# OPTIMIZED: Clean apt cache in same layer
RUN apt-get update && apt-get install -y --no-install-recommends libicu-dev \
&& rm -rf /var/lib/apt/lists/*
.git
node_modules
vendor
tests
docs
var/cache
var/log
docker-compose*.yml
.env.local
*.md
Makefile
| Component | Typical Size | Notes |
|---|---|---|
| Alpine base | 5-8 MB | Minimal Linux |
| Debian slim base | 70-90 MB | More packages available |
| PHP runtime | 25-40 MB | Core PHP binaries |
| PHP extensions (5-8) | 10-30 MB | Depends on extensions |
| Composer vendor (no-dev) | 20-60 MB | Depends on packages |
| Composer vendor (with-dev) | 50-150 MB | PHPUnit, etc. |
| Application code | 1-10 MB | Source files only |
| Build dependencies | 50-200 MB | Must be cleaned |
FROM php:8.4-fpm-alpine AS builder
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS icu-dev libzip-dev \
&& docker-php-ext-install intl zip opcache \
&& apk del .build-deps
COPY composer.json composer.lock ./
RUN composer install --no-dev --prefer-dist --optimize-autoloader
FROM php:8.4-fpm-alpine AS runtime
RUN apk add --no-cache icu-libs libzip
COPY --from=builder /usr/local/lib/php/extensions/ /usr/local/lib/php/extensions/
COPY --from=builder /usr/local/etc/php/conf.d/ /usr/local/etc/php/conf.d/
COPY --from=builder /var/www/vendor /var/www/vendor
COPY . /var/www/
# Find base images used
Grep: "^FROM " --glob "**/Dockerfile*"
# Find missing cache cleanup
Grep: "apt-get install" --glob "**/Dockerfile*"
Grep: "apk add(?!.*--no-cache)" --glob "**/Dockerfile*"
# Find composer install without --no-dev
Grep: "composer install(?!.*--no-dev)" --glob "**/Dockerfile*"
# Find COPY . (copies everything)
Grep: "^COPY \. " --glob "**/Dockerfile*"
# Check for .dockerignore
Glob: "**/.dockerignore"
# Find multi-stage builds
Grep: "^FROM.*AS " --glob "**/Dockerfile*"
| Strategy | Size Reduction | Effort |
|---|---|---|
| Alpine instead of Debian | 100-150 MB | Low |
| Multi-stage build | 50-200 MB | Medium |
| Remove build deps | 50-200 MB | Low |
| --no-dev Composer | 30-80 MB | Low |
| Clean apt/apk cache | 20-50 MB | Low |
| .dockerignore | 10-500 MB | Low |
| Pattern | Severity | Typical Waste |
|---|---|---|
| No multi-stage, build deps remain | Critical | 100-300 MB |
| No .dockerignore, .git copied | Critical | 50-500 MB |
| Debian instead of Alpine (no reason) | Major | 100-150 MB |
| Composer with dev dependencies | Major | 30-80 MB |
| APT/APK cache not cleaned | Minor | 20-50 MB |
### Image Size Issue: [Category]
**Severity:** Critical/Major/Minor
**Current Size:** X MB
**Estimated Savings:** Y MB
**Layer:** Dockerfile:line
**Issue:**
[Description of the bloat source]
**Current:**
```dockerfile
// Current Dockerfile instruction
Optimized:
// Optimized Dockerfile instruction
Expected Size After Fix: Before: X MB -> After: Z MB (saved Y MB)
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub dykyi-roman/awesome-claude-code --plugin acc283 skills in this plugin
/access-control-knowledgeAccess Control knowledge base. Provides ACL, RBAC, ABAC, ReBAC models, multi-tenancy patterns, and PHP implementations (Symfony Voters, Laravel Gates) for security audits and generation./adr-knowledgeAction-Domain-Responder pattern knowledge base. Provides patterns, antipatterns, and PHP-specific guidelines for ADR (web-specific MVC alternative) audits./adr-templateGenerates Architecture Decision Records (ADR) for PHP projects. Creates structured decision documentation with context, decision, and consequences.Other plugins' skills for the same job