polycorr-backend / Dockerfile
dhruv575
Dependency Issues
35ead53
raw
history blame contribute delete
909 Bytes
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install dependencies with pip upgrade to ensure latest resolver
# Use --no-deps for httpx to let OpenAI manage its own dependencies, then install httpx separately
RUN pip install --upgrade pip setuptools wheel && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Expose port (HuggingFace uses port 7860)
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:7860/health')" || exit 1
# Run Flask app with Gunicorn
CMD python -m gunicorn --bind 0.0.0.0:7860 --workers 2 --timeout 120 --access-logfile - --error-logfile - app:app