FROM python:3.12-slim ENV PYTHONUNBUFFERED=1 WORKDIR /app # Install system deps required by numpy/pandas/matplotlib and building wheels RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ gcc \ gfortran \ libatlas3-base \ libopenblas-dev \ liblapack-dev \ libfreetype6-dev \ libpng-dev \ pkg-config \ ca-certificates \ curl \ git \ libglib2.0-0 \ libxrender1 \ libxext6 \ libsm6 \ && rm -rf /var/lib/apt/lists/* # Copy only requirements first for better layer caching COPY requirements.txt /app/requirements.txt # Upgrade pip and install python deps RUN python -m pip install --upgrade pip setuptools wheel && \ python -m pip install -r /app/requirements.txt # Copy only app directory and libs/so (native .so libraries for Linux) COPY app /app/app COPY libs/so /app/libs/so # Set environment variables to use libs/so for native libraries ENV PYTHONPATH="/app" ENV LD_LIBRARY_PATH="/app/libs/so" EXPOSE 8001 # Default command runs uvicorn CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8001"]