# Use a lightweight and stable Python 3.11 base image (Bullseye) FROM python:3.11-slim-bullseye AS base ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PATH="/home/user/.local/bin:$PATH" RUN apt-get update && apt-get install -y \ openssl \ ca-certificates \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user USER user WORKDIR /app COPY --chown=user ./requirements.txt requirements.txt COPY --chown=user ./app/insightfy_utils-0.1.0-py3-none-any.whl insightfy_utils-0.1.0-py3-none-any.whl RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir insightfy_utils-0.1.0-py3-none-any.whl && \ pip install --no-cache-dir --upgrade -r requirements.txt COPY --chown=user . /app EXPOSE 7860 CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860} --workers 4 --log-level info"]