Spaces:
Runtime error

chatbot-2 / Dockerfile
low-key-007's picture
Update Dockerfile
2538844 verified
Raw History Blame Contribute Delete
830 Bytes
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system deps (needed for FAISS, docx, pypdf etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Copy project files
COPY requirements.txt .
COPY app.py .
# Install Python deps
RUN pip install --no-cache-dir -r requirements.txt
# Create persistent storage directory
RUN mkdir -p /data/store
# ✅ Fix: ensure non-root user and give permissions
RUN useradd -ms /bin/bash appuser && chown -R appuser:appuser /data/store
USER appuser
# Declare /data as persistent volume
VOLUME /data
# Expose port for Hugging Face Spaces (they set $PORT)
EXPOSE 7860
# ✅ Use HF $PORT instead of hardcoding 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]