Docker Deployment
ByteMCP includes a production-ready Dockerfile with multi-stage builds.
Quick Start
Section titled “Quick Start”Build the Image
Section titled “Build the Image”docker build -t bytemcp .Run the Container
Section titled “Run the Container”docker run -d \ --name bytemcp \ -p 3000:3000 \ --env-file .env \ bytemcpDockerfile
Section titled “Dockerfile”The included Dockerfile uses a multi-stage build:
# Stage 1: BuildFROM node:18-alpine AS builderWORKDIR /appCOPY package*.json ./RUN npm ci --only=production=falseCOPY . .RUN npm run build
# Stage 2: RuntimeFROM node:18-alpineRUN apk add --no-cache dumb-initWORKDIR /appRUN addgroup -g 1001 nodejs && adduser -u 1001 -G nodejs -s /bin/sh -D nodejsCOPY --from=builder /app/dist ./distCOPY --from=builder /app/node_modules ./node_modulesCOPY --from=builder /app/package.json ./USER nodejsEXPOSE 3000ENV MCP_MODE=remoteENTRYPOINT ["dumb-init", "--"]CMD ["node", "dist/index.js"]Key Features
Section titled “Key Features”- Multi-stage build - Smaller final image
- Non-root user - Security best practice
- dumb-init - Proper signal handling
- Alpine base - Minimal footprint
Docker Compose
Section titled “Docker Compose”For development with database:
version: '3.8'
services: bytemcp: build: . ports: - "3000:3000" environment: - MCP_MODE=remote - DB_HOST=db - DB_DATABASE=bytefederal - DB_USER=bytemcp - DB_PASSWORD=secret depends_on: - db
db: image: mysql:8.0 environment: - MYSQL_DATABASE=bytefederal - MYSQL_USER=bytemcp - MYSQL_PASSWORD=secret - MYSQL_ROOT_PASSWORD=rootsecret volumes: - db_data:/var/lib/mysql - ./init.sql:/docker-entrypoint-initdb.d/init.sql
volumes: db_data:Run with:
docker-compose up -dEnvironment Variables
Section titled “Environment Variables”Pass via --env-file or -e:
# Using env filedocker run --env-file .env bytemcp
# Using individual variablesdocker run \ -e DB_HOST=db.example.com \ -e DB_DATABASE=bytefederal \ -e DB_USER=user \ -e DB_PASSWORD=pass \ -e MCP_MODE=remote \ bytemcpHealth Checks
Section titled “Health Checks”Add health checks to your container:
healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3000/health"] interval: 30s timeout: 10s retries: 3 start_period: 10sNetworking
Section titled “Networking”Connect to External Database
Section titled “Connect to External Database”docker run \ --network host \ --env-file .env \ bytemcpOr specify the database host explicitly:
docker run \ -e DB_HOST=host.docker.internal \ -e DB_DATABASE=bytefederal \ ... bytemcpProduction Considerations
Section titled “Production Considerations”Resource Limits
Section titled “Resource Limits”deploy: resources: limits: cpus: '1.0' memory: 512M reservations: cpus: '0.5' memory: 256MLogging
Section titled “Logging”logging: driver: "json-file" options: max-size: "10m" max-file: "3"Restart Policy
Section titled “Restart Policy”restart: unless-stoppedKubernetes
Section titled “Kubernetes”Basic deployment manifest:
apiVersion: apps/v1kind: Deploymentmetadata: name: bytemcpspec: replicas: 2 selector: matchLabels: app: bytemcp template: metadata: labels: app: bytemcp spec: containers: - name: bytemcp image: bytemcp:latest ports: - containerPort: 3000 envFrom: - secretRef: name: bytemcp-secrets livenessProbe: httpGet: path: /health port: 3000 initialDelaySeconds: 10 periodSeconds: 30Next Steps
Section titled “Next Steps”- Production Deployment - Full production setup
- Remote Mode - HTTP/SSE configuration