Remove env_file from docker-compose and use explicit environment variables

- Remove env_file directive from docker-compose.yml to eliminate .env file dependency
- Add explicit environment variable declarations with default values using ${VAR:-default} syntax
- Update port mapping to use UNRAID_MCP_PORT environment variable for both host and container
- Include all 11 environment variables used by the application with proper defaults
- Update README.md Docker deployment instructions to use export commands instead of .env files
- Update manual Docker run command to use -e flags instead of --env-file

This makes Docker deployment self-contained and follows container best practices.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jacob Magar
2025-08-13 16:41:47 -04:00
parent 6e44c105cd
commit a747aba85b
2 changed files with 32 additions and 8 deletions

View File

@@ -77,11 +77,13 @@ uv sync
The easiest way to run the Unraid MCP Server is with Docker: The easiest way to run the Unraid MCP Server is with Docker:
```bash ```bash
# Clone and configure # Clone repository
git clone https://github.com/jmagar/unraid-mcp git clone https://github.com/jmagar/unraid-mcp
cd unraid-mcp cd unraid-mcp
cp .env.example .env
# Edit .env with your Unraid API details # Set required environment variables
export UNRAID_API_URL="http://your-unraid-server/graphql"
export UNRAID_API_KEY="your_api_key_here"
# Deploy with Docker Compose # Deploy with Docker Compose
docker compose up -d docker compose up -d
@@ -97,7 +99,8 @@ docker build -t unraid-mcp-server .
docker run -d --name unraid-mcp \ docker run -d --name unraid-mcp \
--restart unless-stopped \ --restart unless-stopped \
-p 6970:6970 \ -p 6970:6970 \
--env-file .env \ -e UNRAID_API_URL="http://your-unraid-server/graphql" \
-e UNRAID_API_KEY="your_api_key_here" \
unraid-mcp-server unraid-mcp-server
``` ```

View File

@@ -8,9 +8,30 @@ services:
ports: ports:
# HostPort:ContainerPort (maps to UNRAID_MCP_PORT inside the container, default 6970) # HostPort:ContainerPort (maps to UNRAID_MCP_PORT inside the container, default 6970)
# Change the host port (left side) if 6970 is already in use on your host # Change the host port (left side) if 6970 is already in use on your host
- "6970:6970" - "${UNRAID_MCP_PORT:-6970}:${UNRAID_MCP_PORT:-6970}"
env_file: environment:
- .env # Loads environment variables from .env in the same directory as this docker-compose.yml # Core API Configuration (Required)
# Optional: If you want to mount a specific directory for logs (ensure UNRAID_MCP_LOG_FILE in .env points within this mount) - UNRAID_API_URL=${UNRAID_API_URL}
- UNRAID_API_KEY=${UNRAID_API_KEY}
# MCP Server Settings
- UNRAID_MCP_PORT=${UNRAID_MCP_PORT:-6970}
- UNRAID_MCP_HOST=${UNRAID_MCP_HOST:-0.0.0.0}
- UNRAID_MCP_TRANSPORT=${UNRAID_MCP_TRANSPORT:-streamable-http}
# SSL Configuration
- UNRAID_VERIFY_SSL=${UNRAID_VERIFY_SSL:-true}
# Logging Configuration
- UNRAID_MCP_LOG_LEVEL=${UNRAID_MCP_LOG_LEVEL:-INFO}
- UNRAID_MCP_LOG_FILE=${UNRAID_MCP_LOG_FILE:-unraid-mcp.log}
# Real-time Subscription Configuration
- UNRAID_AUTO_START_SUBSCRIPTIONS=${UNRAID_AUTO_START_SUBSCRIPTIONS:-true}
- UNRAID_MAX_RECONNECT_ATTEMPTS=${UNRAID_MAX_RECONNECT_ATTEMPTS:-10}
# Optional: Custom log file path for subscription auto-start diagnostics
- UNRAID_AUTOSTART_LOG_PATH=${UNRAID_AUTOSTART_LOG_PATH}
# Optional: If you want to mount a specific directory for logs (ensure UNRAID_MCP_LOG_FILE points within this mount)
# volumes: # volumes:
# - ./logs:/app/logs # Example: maps ./logs on host to /app/logs in container # - ./logs:/app/logs # Example: maps ./logs on host to /app/logs in container