feat: implement Docker image optimization - reduces size from 2.6GB to ~200MB
- Add optimized database schema with embedded source code storage - Create optimized rebuild script that extracts source at build time - Implement optimized MCP server reading from pre-built database - Add Dockerfile.optimized with multi-stage build process - Create comprehensive documentation and testing scripts - Demonstrate 92% size reduction by removing runtime n8n dependencies The optimization works by: 1. Building complete database at Docker build time 2. Extracting all node source code into the database 3. Creating minimal runtime image without n8n packages 4. Serving everything from pre-built SQLite database This makes n8n-MCP suitable for resource-constrained production deployments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
41
docker-compose.optimized.yml
Normal file
41
docker-compose.optimized.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
# Docker Compose for optimized n8n-MCP image
|
||||
# This version has pre-built database and minimal runtime dependencies
|
||||
|
||||
services:
|
||||
n8n-mcp-optimized:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.optimized
|
||||
image: n8n-mcp:optimized
|
||||
container_name: n8n-mcp-optimized
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MCP_MODE: ${MCP_MODE:-http}
|
||||
AUTH_TOKEN: ${AUTH_TOKEN:?AUTH_TOKEN is required for HTTP mode}
|
||||
NODE_ENV: production
|
||||
LOG_LEVEL: ${LOG_LEVEL:-info}
|
||||
ports:
|
||||
- "${PORT:-3000}:3000"
|
||||
volumes:
|
||||
# Note: Database is pre-built in the image, no volume needed
|
||||
# Only mount if you need to preserve logs or other runtime data
|
||||
- n8n-mcp-logs:/app/logs
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 256M # Much lower than original!
|
||||
reservations:
|
||||
memory: 128M
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://127.0.0.1:3000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 5s
|
||||
labels:
|
||||
com.n8n-mcp.version: "optimized"
|
||||
com.n8n-mcp.description: "Optimized build with pre-built database"
|
||||
|
||||
volumes:
|
||||
n8n-mcp-logs:
|
||||
name: n8n-mcp-logs
|
||||
Reference in New Issue
Block a user