vaderSentiment / Dockerfile
ArthurY's picture
fix 2
06b1a82
# Use Python 3.11 slim image as base
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy vader_mcp folder (matching ObsPy structure)
COPY vader_mcp /app/vader_mcp
# Copy MCP service requirements
COPY vader_mcp/mcp_output/requirements.txt /app/requirements.txt
# Install Python dependencies with explicit version check
RUN pip install --no-cache-dir -r /app/requirements.txt && \
pip list | grep fastmcp && \
python -c "import fastmcp; print(f'FastMCP version installed: {fastmcp.__version__}')"
# Note: FastAPI and Uvicorn are already included as dependencies of fastmcp
# DO NOT reinstall them separately as it may upgrade fastmcp to a newer version
# Create output directories with write permissions
RUN mkdir -p /app/vader_mcp/mcp_output/mcp_logs \
/app/vader_mcp/mcp_output/output \
&& chmod -R 777 /app/vader_mcp/mcp_output/mcp_logs \
&& chmod -R 777 /app/vader_mcp/mcp_output/output
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV MCP_TRANSPORT=http
# Hugging Face Space uses PORT env var, default to 7860
ENV PORT=7860
ENV MCP_PORT=7860
# Expose port (Hugging Face uses 7860 by default)
EXPOSE 7860
# Start MCP service in HTTP mode
CMD ["python", "/app/vader_mcp/mcp_output/start_mcp.py"]