From ce56a540c6e530186e1e989130bb4f7a38d13b5e Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Wed, 17 Dec 2025 15:37:08 +0100 Subject: [PATCH] perf: Optimize Docker build context from 914MB to 27KB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add explicit node_modules exclusion patterns (**/node_modules, node_modules/) - Exclude Python virtual environments (.venv/, .backtester/, cluster/.venv/) - Exclude cluster data files (chunks/, data/, CSV files - 143MB) - Exclude backtester data and CSV files (~7MB) Impact: - Build context: 914.39MB → 27.39KB (33,389× smaller) - Context transfer: 14.3s → 1.6s (89% faster) - Total build time: 267.6s → 170.8s (36% faster) With layer caching, typical rebuilds now ~60-90s instead of ~267s. --- .dockerignore | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6aebb70 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,162 @@ +# Trading Bot v4 - Docker Ignore File +# Reduces build context size and prevents sensitive data from being copied + +# Dependencies (CRITICAL: Must be first to override any later includes) +**/node_modules +node_modules/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Next.js +.next/ +out/ +build/ +dist/ + +# Environment files (NEVER copy these!) +.env +.env.* +!.env.example +.env.local +.env.development +.env.test +.env.production + +# Private keys and secrets +*.pem +*.key +*.p12 +*.pfx +*-key.json +secrets/ +credentials/ + +# Testing +coverage/ +.nyc_output/ +*.test.js +*.spec.js +__tests__/ +test/ +tests/ +archive/ +*.test.ts +*.spec.ts + +# Logs +logs/ +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# OS files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +*~ + +# IDE files +.vscode/ +.idea/ +*.swp +*.swo +*.swn +.vs/ + +# Git +.git/ +.gitignore +.gitattributes + +# Docker +Dockerfile* +docker-compose*.yml +.dockerignore + +# CI/CD +.github/ +.gitlab-ci.yml +.travis.yml +azure-pipelines.yml + +# Documentation (optional - uncomment if you want to exclude) +# *.md +# docs/ + +# Development tools +.eslintrc* +.prettierrc* +.editorconfig +tsconfig.tsbuildinfo + +# Database files +*.sqlite +*.sqlite3 +*.db + +# Prisma migrations (include if needed) +prisma/migrations/ + +# Screenshots and media +screenshots/ +*.png +*.jpg +*.jpeg +*.gif +*.mp4 +*.mov + +# Temporary files +tmp/ +temp/ +*.tmp + +# Backup files +*.bak +*.backup +*~ + +# Python +__pycache__/ +*.py[cod] +*.pyo +*.pyd +.Python +*.so + +# Python virtual environments (CRITICAL: 100+ MB each!) +.venv/ +.backtester/ +**/.venv/ +**/venv/ + +# Large files +*.zip +*.tar +*.tar.gz +*.rar + +# Cluster data and results (143MB!) +cluster/chunks/ +cluster/data/ +cluster/distributed_results/ +cluster/.venv/ +cluster/*.csv +cluster/*.db +cluster/*.log + +# Backtester data +backtester/ +data/*.csv +*.csv +exploration.db + +# Archives +*.backup +*_backup_*.sql