chore: add root Dockerfile for Hugging Face Spaces deployment
Browse files- Dockerfile +30 -0
Dockerfile
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
# Set the working directory
|
| 4 |
+
WORKDIR /app
|
| 5 |
+
|
| 6 |
+
# Install system dependencies if any are needed
|
| 7 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
+
build-essential \
|
| 9 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
+
|
| 11 |
+
# Copy backend requirements first to leverage Docker cache
|
| 12 |
+
COPY backend/requirements.txt .
|
| 13 |
+
|
| 14 |
+
# Install python dependencies
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
# Copy backend codebase
|
| 18 |
+
COPY backend/ ./backend/
|
| 19 |
+
|
| 20 |
+
# Create data directories and set permissions so Hugging Face user can write to them
|
| 21 |
+
RUN mkdir -p /app/backend/data/sources && chmod -R 777 /app/backend/data
|
| 22 |
+
|
| 23 |
+
# Set PYTHONPATH so Python can locate our backend module
|
| 24 |
+
ENV PYTHONPATH=/app
|
| 25 |
+
|
| 26 |
+
# Expose Hugging Face Spaces default port
|
| 27 |
+
EXPOSE 7860
|
| 28 |
+
|
| 29 |
+
# Run uvicorn on port 7860
|
| 30 |
+
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]
|