Spaces:
Sleeping
Sleeping
Commit ·
9b1ccc2
1
Parent(s): 0235c1d
claude fixes
Browse files- Dockerfile +10 -21
- backend/app.py +2 -2
Dockerfile
CHANGED
|
@@ -1,23 +1,17 @@
|
|
| 1 |
# Dockerfile for Rubric AI on Hugging Face Spaces
|
| 2 |
-
FROM python:3.11
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
# This single block installs ALL necessary compilers and scientific libraries.
|
| 6 |
RUN apt-get update && \
|
| 7 |
apt-get install -y --no-install-recommends \
|
| 8 |
-
# Essential build tools for various Python packages
|
| 9 |
build-essential \
|
| 10 |
-
# Fortran Compiler (Needed for SciPy/NumPy build)
|
| 11 |
gfortran \
|
| 12 |
-
# Linear Algebra Headers (Fixes OpenBLAS/LAPACK dependency errors)
|
| 13 |
libblas-dev \
|
| 14 |
liblapack-dev \
|
| 15 |
libopenblas-dev \
|
| 16 |
-
# Python development headers
|
| 17 |
python3-dev \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
-
# Set working directory
|
| 21 |
WORKDIR /app
|
| 22 |
|
| 23 |
# Create storage directory for NiceGUI with full permissions
|
|
@@ -26,30 +20,25 @@ RUN mkdir -p /storage && chmod 777 /storage
|
|
| 26 |
# Copy requirements first for better caching
|
| 27 |
COPY requirements.txt .
|
| 28 |
|
| 29 |
-
# Install
|
| 30 |
-
# (Note: These need to be on one line or use the explicit package versions)
|
| 31 |
RUN pip install --no-cache-dir \
|
| 32 |
-
numpy
|
| 33 |
-
scikit-learn
|
| 34 |
-
scipy
|
| 35 |
python-multipart
|
| 36 |
|
| 37 |
-
# Install remaining
|
| 38 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 39 |
|
| 40 |
# Copy application code
|
| 41 |
COPY . .
|
| 42 |
|
| 43 |
-
#
|
| 44 |
-
COPY static/ /app/static/
|
| 45 |
-
|
| 46 |
-
# Set environment variables
|
| 47 |
ENV PYTHONUNBUFFERED=1
|
| 48 |
ENV NICEGUI_STORAGE_PATH=/storage
|
| 49 |
|
| 50 |
-
# Expose
|
| 51 |
EXPOSE 7860
|
| 52 |
|
| 53 |
-
# Run
|
| 54 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 55 |
-
RUN mkdir -p /storage && chmod 777 /storage
|
|
|
|
| 1 |
# Dockerfile for Rubric AI on Hugging Face Spaces
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
|
| 4 |
+
# System dependencies for scientific Python packages
|
|
|
|
| 5 |
RUN apt-get update && \
|
| 6 |
apt-get install -y --no-install-recommends \
|
|
|
|
| 7 |
build-essential \
|
|
|
|
| 8 |
gfortran \
|
|
|
|
| 9 |
libblas-dev \
|
| 10 |
liblapack-dev \
|
| 11 |
libopenblas-dev \
|
|
|
|
| 12 |
python3-dev \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
|
|
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
# Create storage directory for NiceGUI with full permissions
|
|
|
|
| 20 |
# Copy requirements first for better caching
|
| 21 |
COPY requirements.txt .
|
| 22 |
|
| 23 |
+
# Install scientific packages first (build from source needs these separate)
|
|
|
|
| 24 |
RUN pip install --no-cache-dir \
|
| 25 |
+
numpy \
|
| 26 |
+
scikit-learn \
|
| 27 |
+
scipy \
|
| 28 |
python-multipart
|
| 29 |
|
| 30 |
+
# Install remaining dependencies
|
| 31 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 32 |
|
| 33 |
# Copy application code
|
| 34 |
COPY . .
|
| 35 |
|
| 36 |
+
# Environment variables
|
|
|
|
|
|
|
|
|
|
| 37 |
ENV PYTHONUNBUFFERED=1
|
| 38 |
ENV NICEGUI_STORAGE_PATH=/storage
|
| 39 |
|
| 40 |
+
# Expose HF Spaces port
|
| 41 |
EXPOSE 7860
|
| 42 |
|
| 43 |
+
# Run application
|
| 44 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
backend/app.py
CHANGED
|
@@ -28,8 +28,8 @@ def create_app() -> FastAPI:
|
|
| 28 |
allow_headers=["*"],
|
| 29 |
)
|
| 30 |
|
| 31 |
-
# Include API routes
|
| 32 |
-
app.include_router(api_router)
|
| 33 |
|
| 34 |
# Health check endpoint
|
| 35 |
@app.get("/health")
|
|
|
|
| 28 |
allow_headers=["*"],
|
| 29 |
)
|
| 30 |
|
| 31 |
+
# Include API routes with /api prefix to avoid NiceGUI mount conflicts
|
| 32 |
+
app.include_router(api_router, prefix="/api")
|
| 33 |
|
| 34 |
# Health check endpoint
|
| 35 |
@app.get("/health")
|