Spaces:
Runtime error
Runtime error
Commit ·
fba31c1
1
Parent(s): 2e9afea
Fix requirements path in root Dockerfile
Browse files11243458610712891510111213142021151617232418192021222329242526323327282935363031323334# Use Python 3.10 slim as base imageFROM python:3.10-slim
# Set working directory inside the containerWORKDIR /app
# Set environment variables# Prevent Python from writing .pyc files to diskENV PYTHONDONTWRITEBYTECODE=1# Prevent Python from buffering stdout/stderrENV PYTHONUNBUFFERED=1# Set Hugging Face cache directory to a path inside /appENV HF_HOME=/app/.cache/huggingface
# Install system dependencies required for building python extensions (like scikit-learn or chromadb if needed)# Install system packages required for compiling libraries (like chromadb)RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/*
# Copy requirements file first to leverage Docker cacheCOPY requirements.txt /app/# Copy requirements.txt from the server/ subdirectory (Crucial difference!)COPY server/requirements.txt /app/server/
# Install python dependenciesRUN pip install --no-cache-dir -r requirements.txt# Install Python dependenciesRUN pip install --no-cache-dir -r /app/server/requirements.txt
# Pre-download and cache the SentenceTransformer model during build timeRUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-large-en-v1.5')"
# Copy the rest of the backend application code# Copy the entire project (both client/ and server/)COPY . /app/
# Expose the port FastAPI will run onEXPOSE 8000# Change working directory to server where main.py residesWORKDIR /app/server
# Command to run the application using uvicornCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]# Expose Hugging Face Spaces default portEXPOSE 7860
# Run FastAPI using uvicorn on port 7860CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]Dockerfile+13-15