feat: add comprehensive Docker support with multi-stage builds and compose configurations

This commit is contained in:
czlonkowski
2025-06-13 16:12:40 +02:00
parent edb9c51096
commit 12bef3d98e
11 changed files with 938 additions and 72 deletions

View File

@@ -1,42 +1,52 @@
# docker-compose.yml
version: '3.8'
services:
n8n-docs-mcp:
build: .
container_name: n8n-docs-mcp
volumes:
- ./data:/app/data
environment:
- NODE_ENV=production
- NODE_DB_PATH=/app/data/nodes-v2.db
- MCP_LOG_LEVEL=info
ports:
- "3000:3000" # Only needed if using HTTP mode
command: node dist/index-v2.js
n8n-mcp:
image: ghcr.io/czlonkowski/n8n-mcp:latest
container_name: n8n-mcp
restart: unless-stopped
# HTTP mode (for remote access)
n8n-docs-mcp-http:
build: .
container_name: n8n-docs-mcp-http
volumes:
- ./data:/app/data
# Environment configuration
environment:
- NODE_ENV=production
- NODE_DB_PATH=/app/data/nodes-v2.db
- MCP_LOG_LEVEL=info
- MCP_PORT=3000
- MCP_HOST=0.0.0.0
- MCP_DOMAIN=${MCP_DOMAIN:-localhost}
- MCP_AUTH_TOKEN=${MCP_AUTH_TOKEN}
- MCP_CORS=true
# Mode configuration
MCP_MODE: ${MCP_MODE:-http}
AUTH_TOKEN: ${AUTH_TOKEN:?AUTH_TOKEN is required for HTTP mode}
# Application settings
NODE_ENV: ${NODE_ENV:-production}
LOG_LEVEL: ${LOG_LEVEL:-info}
PORT: ${PORT:-3000}
# Database
NODE_DB_PATH: ${NODE_DB_PATH:-/app/data/nodes.db}
REBUILD_ON_START: ${REBUILD_ON_START:-false}
# Volumes for persistence
volumes:
- n8n-mcp-data:/app/data
# Port mapping
ports:
- "3000:3000"
command: node dist/index-http.js
restart: unless-stopped
profiles:
- http
- "${PORT:-3000}:3000"
# Resource limits
deploy:
resources:
limits:
memory: 512M
reservations:
memory: 256M
# Health check
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Usage:
# Local mode: docker-compose up n8n-docs-mcp
# HTTP mode: docker-compose --profile http up n8n-docs-mcp-http
# Named volume for data persistence
volumes:
n8n-mcp-data:
driver: local