Spaces:
Running
Running
File size: 1,279 Bytes
8eb6710 6489319 8eb6710 6489319 8eb6710 6489319 8eb6710 2ebd9eb 8eb6710 73ee418 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# Multi-stage build for hf-eda-mcp server
FROM python:3.13-slim as builder
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
# Install PDM
RUN pip install --no-cache-dir pdm
# Copy dependency files and source code
COPY pyproject.toml pdm.lock* ./
COPY src/ ./src/
COPY README.md LICENSE ./
# Install dependencies and project
RUN pdm install --prod --no-lock --no-editable
# Production stage
FROM python:3.13-slim
# Set working directory
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy installed dependencies from builder
COPY --from=builder /app/.venv /app/.venv
# Copy application code
COPY src/ ./src/
COPY README.md LICENSE ./
# Set environment variables
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONUNBUFFERED=1
ENV HF_EDA_HOST="0.0.0.0"
ENV HF_EDA_PORT=7860
# Expose Gradio port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:7860/health', timeout=5)"
# Run the MCP server
CMD ["python", "-m", "hf_eda_mcp", "--port", "7860", "--host", "0.0.0.0"]
|