CVE-FactChecker / Dockerfile
NLPGenius's picture
Fix permission errors, rate limiting, and add English language filtering
e06a21d
raw
history blame
1.18 kB
# Hugging Face Spaces - Docker runtime for Flask API
# Using a slim Python base to keep image small
FROM python:3.11-slim
# Prevent Python from buffering stdout/stderr
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PORT=7860 \
SENTENCE_TRANSFORMERS_HOME=/tmp/sentence_transformers \
VECTOR_PERSIST_DIR=/tmp/vector_db
# System deps for chromadb and sentence-transformers
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Create necessary directories with proper permissions
RUN mkdir -p /tmp/vector_db /tmp/sentence_transformers /app/logs && \
chmod 777 /tmp/vector_db /tmp/sentence_transformers /app/logs
# Install Python deps early for better layer caching
COPY requirements.txt ./
RUN pip install --upgrade pip && pip install -r requirements.txt && pip install gunicorn
# Copy application code
COPY . .
# Make scripts executable
RUN chmod +x *.py
# Expose the port used by Hugging Face Spaces
EXPOSE 7860
# Use our production startup script for better error handling
CMD ["python", "run_production.py"]