docker-compose.yml•6.02 kB
###############################################################################
# NETWORKS + VOLUMES - declared first so they can be referenced later
###############################################################################
networks:
# Single user-defined bridge network keeps traffic private
mcpnet:
driver: bridge
# Named volumes survive podman-compose down/up
volumes:
# Keep Redis data volume
redis_data:
# Keep Redis Insight data volume
redisinsight_data:
###############################################################################
# CORE SERVICE - MCP Gateway
###############################################################################
services:
# ──────────────────────────────────────────────────────────────────────
# MCP Gateway - the main API server for the MCP stack
# ──────────────────────────────────────────────────────────────────────
gateway:
# Use the official image instead of non-existent local one
user: "1001:0"
image: ghcr.io/ibm/mcp-context-forge:0.3.0
# Comment out the build section since we're using pre-built image
# build:
# context: .
# dockerfile: Containerfile
restart: unless-stopped
ports:
# HTTP (or HTTPS if SSL=true is set)
- "4444:4444"
networks: [mcpnet]
# More aggressive Surface Pro 6 RAM optimization
deploy:
resources:
limits:
# Reduced from 1G
memory: 512M
# Reduced from 2.0
cpus: '1.0'
reservations:
# Reduced from 512M
memory: 256M
# Reduced from 1.0
cpus: '0.5'
# Use .env file for all environment variables
env_file:
- .env
# If you want to override/add a variable not in .env, add a single environment: block here
# environment:
# - PYTHONUNBUFFERED=1
# - PYTHONDONTWRITEBYTECODE=1
# - PYTHON_OPTIMIZE=1
# Remove postgres dependency since using SQLite
depends_on:
redis:
condition: service_started
# Use volume mount for database persistence
volumes:
# Mount data directory
- ./data:/app/data
# Optional: for log persistence
- ./logs:/app/logs
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:4444/health')"]
interval: 30s
timeout: 10s
retries: 5
start_period: 20s
# Comment out or remove postgres service since using SQLite
# postgres:
# image: postgres:17
# environment:
# - POSTGRES_USER=postgres
# - POSTGRES_PASSWORD=mysecretpassword
# - POSTGRES_DB=mcp
# volumes:
# - pgdata:/var/lib/postgresql/data
# networks: [mcpnet]
# Optimize Redis for Surface Pro 6
redis:
# Use Alpine for smaller memory footprint
image: redis:7-alpine
ports:
- "6379:6379"
networks: [mcpnet]
# Surface Pro 6 RAM Optimization: Add memory limits and config
deploy:
resources:
limits:
# Limit Redis to 256MB
memory: 256M
# Limit to 0.5 CPU cores
cpus: '0.5'
reservations:
# Reserve minimum 128MB
memory: 128M
# Redis configuration for low memory usage
command: redis-server --maxmemory 200mb --maxmemory-policy allkeys-lru --save ""
# Optional: persist Redis data
volumes:
# Keep Redis data volume
- redis_data:/data
# Comment out pgadmin since not using PostgreSQL
# pgadmin:
# image: dpage/pgadmin4:latest
# Optimize Redis Insight for Surface Pro 6
redis_insight:
image: redis/redisinsight:latest
container_name: redisinsight
restart: unless-stopped
networks: [mcpnet]
ports:
- "5540:5540"
# Surface Pro 6 RAM Optimization: Add memory limits
deploy:
resources:
limits:
# Limit Redis Insight to 256MB
memory: 256M
# Limit to 0.5 CPU cores
cpus: '0.5'
depends_on:
redis:
condition: service_started
volumes:
# Keep Redis Insight data volume
- redisinsight_data:/data
environment:
# Redis Insight environment variables
- RI_REDIS_HOST=redis
- RI_REDIS_PORT=6379
- RI_REDIS_USERNAME=default
- RI_APP_HOST=0.0.0.0
- RI_APP_PORT=5540
# ──────────────────────────────────────────────────────────────────────
# MCP Auto-Discovery Service - runs discovery on startup
# ──────────────────────────────────────────────────────────────────────
autodiscovery:
image: python:3.11-slim
container_name: mcp-autodiscovery
networks: [mcpnet]
# Run autodiscovery script
command: >
sh -c "
echo 'Installing dependencies...' &&
pip install --no-cache-dir requests &&
echo 'Starting MCP Auto-Discovery...' &&
python3 /app/autodiscovery.py
"
# Mount the autodiscovery script and .env file
volumes:
- ./autodiscovery.py:/app/autodiscovery.py:ro
- ./.env:/app/.env:ro
# Set working directory
working_dir: /app
# Resource limits for Surface Pro 6
deploy:
resources:
limits:
memory: 128M
cpus: '0.25'
# Run after gateway is up
depends_on:
gateway:
condition: service_healthy
# Restart policy (run once on startup)
restart: "no"