File size: 873 Bytes
310260a | 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 | # Backend Dockerfile
FROM python:3.11-slim
# Working directory set karein
WORKDIR /app
# System dependencies
RUN apt-get update && apt-get install -y \
gcc \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# Requirements copy aur install karein
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Baaki saara code copy karein
COPY . .
# Hugging Face ke liye Permissions (User 1000)
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
# Hugging Face ke liye PORT 7860 lazmi hai
EXPOSE 7860
# Health check (Port 7860 ke saath)
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:7860/health')"
# Run application (Yahan main:app check karlein)
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "7860"] |