Azam-Rabiee/wealthy-estimator-api
0
1# Use Python 3.9 slim image2FROM python:3.9-slim3 4# Set working directory5WORKDIR /app6 7# Install system dependencies including curl for health checks8RUN apt-get update && apt-get install -y \9 gcc \10 g++ \11 curl \12 && rm -rf /var/lib/apt/lists/*13 14# Copy requirements first for better caching15COPY requirements.txt .16 17# Install Python dependencies18RUN pip install --no-cache-dir -r requirements.txt19 20# Copy application code21COPY app/ ./app/22COPY data/ ./data/23 24# Health check (define before switching user)25HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \26 CMD curl -f http://localhost:8000/health || exit 127 28# Create non-root user29RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app30USER appuser31 32# Expose port33EXPOSE 800034 35# Run the application36CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] 