.dockerignore Generator
Generates optimized .dockerignore files for PHP projects, reducing build context size and improving build performance.
Generated Files
.dockerignore # Optimized exclusion rules
Generation Instructions
- Detect project type: Check for
symfony.lock (Symfony), artisan (Laravel), or generic PHP
- Analyze existing files: Read
.gitignore, check CI/CD config, identify test/doc directories
- Generate .dockerignore: Universal exclusions + framework-specific + proper
! negations
Universal PHP .dockerignore
# ===========================================
# .dockerignore — PHP Project
# ===========================================
# Version Control
.git
.gitignore
.gitattributes
.gitmodules
# CI/CD
.github
.gitlab
.gitlab-ci.yml
.circleci
Jenkinsfile
bitbucket-pipelines.yml
# IDE
.idea
.vscode
*.sublime-project
*.sublime-workspace
*.swp
*.swo
*~
# Dependencies (installed in container)
vendor/
node_modules/
# Testing
tests/
test/
spec/
phpunit.xml
phpunit.xml.dist
.phpunit.result.cache
.phpunit.cache/
behat.yml
behat.yml.dist
infection.json
infection.json.dist
# Documentation
docs/
doc/
*.md
!README.md
LICENSE
# Development Files
docker-compose*.yml
docker-compose*.yaml
Dockerfile*
.docker/
Makefile
Vagrantfile
# Cache and Temporary Files
var/cache/
var/log/
storage/logs/
storage/framework/cache/
storage/framework/sessions/
storage/framework/views/
*.log
tmp/
temp/
# Local Configuration
.env
.env.local
.env.*.local
.env.test
*.local.php
docker-compose.override.yml
# Static Analysis
phpstan.neon
phpstan.neon.dist
phpstan-baseline.neon
psalm.xml
psalm.xml.dist
.php-cs-fixer.php
.php-cs-fixer.dist.php
.php-cs-fixer.cache
.phpcs-cache
phpcs.xml
phpcs.xml.dist
deptrac.yaml
rector.php
ecs.php
pint.json
# Build Artifacts
coverage/
build/
report/
reports/
clover.xml
coverage.xml
# OS Files
.DS_Store
Thumbs.db
# Package Management
composer.phar
auth.json
# Claude / AI
.claude/
CLAUDE.md
Symfony-Specific Additions
# Symfony
symfony.lock
var/
assets/
public/build/
.symfony/
.symfony.local.yaml
.phpunit/
Laravel-Specific Additions
# Laravel
storage/
bootstrap/cache/
docker-compose.sail.yml
public/hot
public/storage
public/build/
public/mix-manifest.json
_ide_helper*.php
.phpstorm.meta.php
Homestead.json
Homestead.yaml
Important Negations
# Required Files (do NOT exclude)
!composer.json
!composer.lock
!symfony.lock
!.env.dist
!.env.example
Build Context Impact
| Pattern |
Typical savings |
.git |
50-500 MB |
vendor/ |
100-500 MB |
node_modules/ |
200-800 MB |
tests/ |
5-50 MB |
Validation Rules
- Never exclude:
composer.json, composer.lock, source code (src/, app/, config/, public/), migrations
- Always exclude:
.git, vendor/, tests, IDE files, local env files with secrets
- Framework awareness: Symfony: exclude
var/, keep config/, public/, templates/; Laravel: exclude storage/, keep config/, public/, resources/
Usage
Provide:
- Framework (Symfony/Laravel/generic PHP)
- Monorepo structure (yes/no)
- Custom exclusions (optional)
The generator will:
- Create
.dockerignore with universal exclusions
- Add framework-specific exclusions
- Add proper negation rules for required files
- Optimize for minimal build context
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: create-dockerignore3description: Generates optimized .dockerignore files for PHP projects. Excludes tests, docs, IDE files, and development artifacts to minimize build context.4---56# .dockerignore Generator78Generates optimized `.dockerignore` files for PHP projects, reducing build context size and improving build performance.910## Generated Files1112```13.dockerignore # Optimized exclusion rules14```1516## Generation Instructions17181. **Detect project type:** Check for `symfony.lock` (Symfony), `artisan` (Laravel), or generic PHP192. **Analyze existing files:** Read `.gitignore`, check CI/CD config, identify test/doc directories203. **Generate .dockerignore:** Universal exclusions + framework-specific + proper `!` negations2122## Universal PHP .dockerignore2324```25# ===========================================26# .dockerignore — PHP Project27# ===========================================2829# Version Control30.git31.gitignore32.gitattributes33.gitmodules3435# CI/CD36.github37.gitlab38.gitlab-ci.yml39.circleci40Jenkinsfile41bitbucket-pipelines.yml4243# IDE44.idea45.vscode46*.sublime-project47*.sublime-workspace48*.swp49*.swo50*~5152# Dependencies (installed in container)53vendor/54node_modules/5556# Testing57tests/58test/59spec/60phpunit.xml61phpunit.xml.dist62.phpunit.result.cache63.phpunit.cache/64behat.yml65behat.yml.dist66infection.json67infection.json.dist6869# Documentation70docs/71doc/72*.md73!README.md74LICENSE7576# Development Files77docker-compose*.yml78docker-compose*.yaml79Dockerfile*80.docker/81Makefile82Vagrantfile8384# Cache and Temporary Files85var/cache/86var/log/87storage/logs/88storage/framework/cache/89storage/framework/sessions/90storage/framework/views/91*.log92tmp/93temp/9495# Local Configuration96.env97.env.local98.env.*.local99.env.test100*.local.php101docker-compose.override.yml102103# Static Analysis104phpstan.neon105phpstan.neon.dist106phpstan-baseline.neon107psalm.xml108psalm.xml.dist109.php-cs-fixer.php110.php-cs-fixer.dist.php111.php-cs-fixer.cache112.phpcs-cache113phpcs.xml114phpcs.xml.dist115deptrac.yaml116rector.php117ecs.php118pint.json119120# Build Artifacts121coverage/122build/123report/124reports/125clover.xml126coverage.xml127128# OS Files129.DS_Store130Thumbs.db131132# Package Management133composer.phar134auth.json135136# Claude / AI137.claude/138CLAUDE.md139```140141## Symfony-Specific Additions142143```144# Symfony145symfony.lock146var/147assets/148public/build/149.symfony/150.symfony.local.yaml151.phpunit/152```153154## Laravel-Specific Additions155156```157# Laravel158storage/159bootstrap/cache/160docker-compose.sail.yml161public/hot162public/storage163public/build/164public/mix-manifest.json165_ide_helper*.php166.phpstorm.meta.php167Homestead.json168Homestead.yaml169```170171## Important Negations172173```174# Required Files (do NOT exclude)175!composer.json176!composer.lock177!symfony.lock178!.env.dist179!.env.example180```181182## Build Context Impact183184| Pattern | Typical savings |185|---|---|186| `.git` | 50-500 MB |187| `vendor/` | 100-500 MB |188| `node_modules/` | 200-800 MB |189| `tests/` | 5-50 MB |190191## Validation Rules1921931. **Never exclude:** `composer.json`, `composer.lock`, source code (`src/`, `app/`, `config/`, `public/`), migrations1942. **Always exclude:** `.git`, `vendor/`, tests, IDE files, local env files with secrets1953. **Framework awareness:** Symfony: exclude `var/`, keep `config/`, `public/`, `templates/`; Laravel: exclude `storage/`, keep `config/`, `public/`, `resources/`196197## Usage198199Provide:200- Framework (Symfony/Laravel/generic PHP)201- Monorepo structure (yes/no)202- Custom exclusions (optional)203204The generator will:2051. Create `.dockerignore` with universal exclusions2062. Add framework-specific exclusions2073. Add proper negation rules for required files2084. Optimize for minimal build context209210---211> Converted and distributed by [TomeVault](https://tomevault.io/claim/dykyi-roman) — claim your Tome and manage your conversions.212<!-- tomevault:4.0:skill_md:2026-04-11 -->