Spaces:
Sleeping
Sleeping
File size: 1,297 Bytes
07355a1 bcf226e ce673e5 07355a1 ce673e5 07355a1 ce673e5 07355a1 ce673e5 07355a1 ce673e5 07355a1 ce673e5 07355a1 ce673e5 07355a1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | # OpenTriage AI Engine - Full Backend
# Hugging Face Spaces Deployment
# Cache bust: 2026-02-09-v3 - Force rebuild with fixed imports
FROM python:3.10-slim
# Create non-root user (Hugging Face requirement)
RUN useradd -m -u 1000 user
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY --chown=user:user requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=user:user . .
# Set permissions for user (needed for vector DB caches, etc.)
RUN chown -R user:user /app
# Switch to non-root user
USER user
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
ENV HOME=/home/user
ENV PATH="/home/user/.local/bin:$PATH"
# Expose port (Hugging Face Spaces uses 7860)
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1
# Run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|