Spaces:
Runtime error
Runtime error
Commit
·
151329b
1
Parent(s):
9cd1f53
add dockerfile
Browse files- Dockerfile +47 -0
Dockerfile
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.13-slim
|
| 2 |
+
|
| 3 |
+
# Set environment variables
|
| 4 |
+
ENV PYTHONUNBUFFERED=1
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
+
ENV GRADIO_SERVER_NAME=0.0.0.0
|
| 7 |
+
ENV GRADIO_SERVER_PORT=7860
|
| 8 |
+
|
| 9 |
+
# System dependencies
|
| 10 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
+
clang \
|
| 12 |
+
llvm-dev \
|
| 13 |
+
build-essential \
|
| 14 |
+
curl \
|
| 15 |
+
git \
|
| 16 |
+
pkg-config \
|
| 17 |
+
wget \
|
| 18 |
+
ca-certificates \
|
| 19 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
+
|
| 21 |
+
# Create a non-root user for HuggingFace Spaces
|
| 22 |
+
RUN useradd -m -u 1000 user
|
| 23 |
+
WORKDIR /app
|
| 24 |
+
|
| 25 |
+
# Copy requirements first for better caching
|
| 26 |
+
COPY requirements.txt /app/requirements.txt
|
| 27 |
+
|
| 28 |
+
# Install Python dependencies
|
| 29 |
+
RUN pip install --no-cache-dir -r /app/requirements.txt && \
|
| 30 |
+
pip install --no-cache-dir libclang
|
| 31 |
+
|
| 32 |
+
# Copy application code (excluding large data files)
|
| 33 |
+
COPY --chown=user:user . /app
|
| 34 |
+
|
| 35 |
+
# Set ownership
|
| 36 |
+
RUN chown -R user:user /app
|
| 37 |
+
|
| 38 |
+
# Switch to non-root user
|
| 39 |
+
USER user
|
| 40 |
+
|
| 41 |
+
# Expose the Gradio port
|
| 42 |
+
EXPOSE 7860
|
| 43 |
+
|
| 44 |
+
# Default command - can be overridden to use --hf-dataset instead of --graph-file
|
| 45 |
+
# To use HuggingFace dataset: --hf-dataset "username/dataset-name"
|
| 46 |
+
# To use local file: --graph-file "/app/data/multihop_knowledge_graph_with_embeddings.json"
|
| 47 |
+
CMD ["python", "-u", "smolagent_chat.py"]
|