Skip to main content
Glama
DOCKER_IMPLEMENTATION.md8.65 kB
# Docker Implementation Summary This document summarizes the Docker implementation for the MCP Process Server. ## Files Created ### 1. Dockerfile **Location**: `packages/mcp-process/Dockerfile` Multi-stage optimized Dockerfile with: - **Stage 1 (Builder)**: Builds the TypeScript application - **Stage 2 (Runtime)**: Minimal Alpine-based runtime image **Key Features**: - Multi-stage build for minimal image size - Non-root user (UID 1001) - Alpine Linux base for security - Tini init system for proper signal handling - Health check included - Comprehensive OCI labels **Security**: - Runs as non-root user `mcp` (UID 1001) - Minimal dependencies - No unnecessary packages - Read-only configuration volume ### 2. .dockerignore **Location**: `packages/mcp-process/.dockerignore` Optimizes Docker build by excluding: - node_modules (installed in container) - Test files - Development files - Documentation (except README/LICENSE) - Build artifacts ### 3. docker-compose.yml **Location**: `packages/mcp-process/docker-compose.yml` Production-ready Docker Compose configuration with: - Security hardening (no-new-privileges, capability dropping) - Resource limits (CPU, memory) - Volume mounts for configuration - Health checks - Logging configuration - Network isolation (stdio transport) **Security Features**: - Drops all capabilities, adds only essential ones - Runs as non-root user - Read-only configuration mount - Resource limits enforced - No network access (stdio only) ### 4. docker-compose.override.yml.example **Location**: `packages/mcp-process/docker-compose.override.yml.example` Development override example with: - More permissive resource limits - Network access for development - Source code mounting option - Debug environment variables ### 5. docker-config.json **Location**: `packages/mcp-process/docker-config.json` Secure default configuration for Docker deployments: - Minimal allowlist (node, npm, python3, git) - Shell interpreters blocked - Setuid executables blocked - Conservative resource limits - Audit logging enabled ### 6. DOCKER.md **Location**: `packages/mcp-process/DOCKER.md` Comprehensive Docker usage guide covering: - Quick start instructions - Configuration examples - Security considerations - Building and testing - Usage examples - Troubleshooting - Advanced topics (Kubernetes, custom images) ### 7. GitHub Actions Workflow **Location**: `packages/mcp-process/.github/workflows/docker-publish.yml` Automated CI/CD pipeline for Docker publishing: **Features**: - Multi-platform builds (AMD64, ARM64) - Automatic tagging (semver, branch, SHA) - Security scanning (Trivy) - SBOM generation - Automated testing - Docker Hub description updates - GitHub Container Registry publishing **Triggers**: - Push to main/develop branches - Version tags (v*.*.\*) - Pull requests (build only) - Manual workflow dispatch **Stages**: 1. Build and push images 2. Security scanning 3. SBOM generation 4. Smoke tests 5. Notification ### 8. Docker Setup Guide **Location**: `packages/mcp-process/.github/DOCKER_SETUP.md` Step-by-step guide for setting up Docker Hub publishing: - Creating Docker Hub access tokens - Configuring GitHub secrets - Workflow explanation - Troubleshooting - Customization options - Best practices ### 9. Test Scripts **Location**: `packages/mcp-process/scripts/` #### docker-test.sh (Bash) Comprehensive local testing script: - Builds image - Tests help command - Tests config creation - Verifies non-root user - Tests container startup - Checks logs - Runs health checks - Security scanning (if Trivy available) - Multi-platform build test #### docker-test.ps1 (PowerShell) Windows equivalent of docker-test.sh with same functionality. ### 10. Documentation Updates #### README.md Updated with: - Docker installation as recommended method - Docker quick start section - Link to DOCKER.md #### package.json Added scripts: - `docker:build`: Build local image - `docker:test`: Run test script - `docker:run`: Start with docker-compose - `docker:stop`: Stop docker-compose - `docker:logs`: View logs Added files to npm package: - DOCKER.md - Dockerfile - docker-compose.yml - docker-config.json ## Security Implementation ### Container Security 1. **Non-root User** - Runs as UID 1001 (user `mcp`) - No privilege escalation possible 2. **Minimal Base Image** - Alpine Linux for small attack surface - Only essential packages installed 3. **Capability Dropping** - Drops ALL capabilities - Adds only CHOWN, SETUID, SETGID 4. **Resource Limits** - CPU: 2 cores max, 0.5 reserved - Memory: 2GB max, 512MB reserved 5. **Network Isolation** - No network access (stdio transport) - Can be enabled for development 6. **Read-only Configuration** - Config mounted read-only - Prevents tampering ### Application Security The Docker configuration enforces the same security as the application: 1. **Executable Allowlist**: Only approved executables 2. **Shell Blocking**: Shell interpreters blocked by default 3. **Setuid Blocking**: No setuid/setgid executables 4. **Resource Limits**: Per-process limits enforced 5. **Audit Logging**: All operations logged ## Usage ### Quick Start ```bash # Pull image docker pull digitaldefiance/mcp-process:latest # Create config mkdir -p config cat > config/mcp-process-config.json << EOF { "allowedExecutables": ["node", "python3"], "maxConcurrentProcesses": 5, "enableAuditLog": true } EOF # Run docker-compose up -d ``` ### Local Development ```bash # Build locally npm run docker:build # Test npm run docker:test # Run npm run docker:run # View logs npm run docker:logs # Stop npm run docker:stop ``` ### CI/CD The GitHub Actions workflow automatically: 1. Builds on push to main/develop 2. Tags with version on release 3. Scans for vulnerabilities 4. Generates SBOM 5. Tests the image 6. Publishes to Docker Hub and GHCR ## Image Details ### Registries - **Docker Hub**: `digitaldefiance/mcp-process` - **GitHub Container Registry**: `ghcr.io/digital-defiance/ai-capabilities-suite/mcp-process` ### Tags - `latest`: Latest build from main branch - `develop`: Latest build from develop branch - `v1.2.3`: Semantic version tags - `v1.2`: Major.minor version - `v1`: Major version - `main-abc123`: Branch + commit SHA ### Platforms - `linux/amd64`: x86_64 architecture - `linux/arm64`: ARM64 architecture (Apple Silicon, ARM servers) ### Size Optimized multi-stage build results in minimal image size: - Base image: ~50MB (Alpine + Node.js) - Application: ~20MB - Total: ~70MB (approximate) ## Testing ### Automated Tests The workflow includes: 1. Help command test 2. Config creation test 3. Security scan (Trivy) 4. Smoke test (container startup) 5. Health check verification ### Local Testing ```bash # Run full test suite bash scripts/docker-test.sh # Or on Windows powershell scripts/docker-test.ps1 ``` ### Manual Testing ```bash # Build docker build -t mcp-process:test . # Run docker run -d --name test -v $(pwd)/config:/app/config:ro -i mcp-process:test # Check logs docker logs test # Test health docker inspect --format='{{.State.Health.Status}}' test # Cleanup docker stop test && docker rm test ``` ## Troubleshooting ### Common Issues 1. **Permission denied**: Ensure config directory is readable 2. **Container exits**: Check configuration is valid 3. **Cannot execute**: Add executables to allowlist 4. **Resource limits**: Adjust in docker-compose.yml See DOCKER.md for detailed troubleshooting. ## Future Enhancements Potential improvements: 1. Image signing with Cosign 2. Distroless base image option 3. Helm chart for Kubernetes 4. Multi-registry publishing 5. Automated vulnerability patching 6. Performance benchmarking ## Requirements Validation This implementation satisfies Requirements 15.1-15.5: ✅ **15.1**: Published to Docker Hub and GHCR ✅ **15.2**: Available as Docker image with automated builds ✅ **15.3**: Appears in registries with complete metadata ✅ **15.4**: Installable with single command (docker pull) ✅ **15.5**: Includes secure default configuration and documentation ## Conclusion The Docker implementation provides: - **Easy deployment**: Single command to run - **Security**: Multiple layers of protection - **Automation**: CI/CD pipeline for publishing - **Documentation**: Comprehensive guides - **Testing**: Automated and manual test scripts - **Flexibility**: Development and production configurations The implementation follows Docker and security best practices while maintaining the strict security boundaries of the MCP Process Server.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Digital-Defiance/mcp-process'

If you have feedback or need assistance with the MCP directory API, please join our Discord server