OpenTriage_AI / Dockerfile
KrishnaCosmic's picture
checking changes
bcf226e
# 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"]