File size: 1,210 Bytes
ce21092 3ec78dd 7e00a52 |
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 |
FROM python:3.13-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
clang \
llvm-dev \
build-essential \
curl \
git \
pkg-config \
wget \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user for HuggingFace Spaces
RUN useradd -m -u 1000 user
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt /app/requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir -r /app/requirements.txt && \
pip install --no-cache-dir libclang
# Copy application code (excluding large data files)
COPY --chown=user:user . /app
# Set ownership
RUN chown -R user:user /app
# Switch to non-root user
USER user
# Expose the Gradio port
EXPOSE 7860
# Default command - can be overridden to use --hf-dataset instead of --graph-file
# To use HuggingFace dataset: --hf-dataset "username/dataset-name"
# To use local file: --graph-file "/app/data/multihop_knowledge_graph_with_embeddings.json"
CMD ["python", "-u", "gradio_mcp_space.py"]
|