Files
AI-Trader/Dockerfile
Bill d70362b9d4 fix: improve MCP service startup reliability
- Clarify OPENAI_API_BASE can be left empty for default endpoint
- Increase initial wait time from 3s to 5s
- Add health checking for all MCP services (ports 8000-8003)
- Retry up to 10 times with 1s intervals
- Install netcat for port checking
- Display warnings if services aren't ready

Helps diagnose and prevent MCP client initialization errors.
2025-10-30 21:32:42 -04:00

44 lines
1.0 KiB
Docker

# Base stage - dependency installation
FROM python:3.10-slim AS base
WORKDIR /app
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends netcat-openbsd && \
rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Application stage
FROM base
WORKDIR /app
# Copy application code
COPY . .
# Copy data scripts to separate directory (volume mount won't overlay these)
RUN mkdir -p /app/scripts && \
cp data/get_daily_price.py /app/scripts/ && \
cp data/get_interdaily_price.py /app/scripts/ && \
cp data/merge_jsonl.py /app/scripts/
# Create necessary directories
RUN mkdir -p data logs data/agent_data
# Make entrypoint executable
RUN chmod +x entrypoint.sh
# Expose MCP service ports and web dashboard
EXPOSE 8000 8001 8002 8003 8888
# Set Python to run unbuffered for real-time logs
ENV PYTHONUNBUFFERED=1
# Use entrypoint script
ENTRYPOINT ["./entrypoint.sh"]
CMD ["configs/default_config.json"]