FROM python:3.9 RUN apt-get update && apt-get install -y curl wget netcat-traditional && \ curl -fsSL https://ollama.com/install.sh | sh && \ useradd -m -u 1000 user WORKDIR /app COPY --chown=user . . RUN pip install --no-cache-dir -r requirements.txt RUN printf "#!/bin/bash\ncd /app\nollama serve & \ sleep 30 && ollama create llama3.2:1b-papalia -f Modelfile \ && exec uvicorn app:app --host 0.0.0.0 --port 7860 --workers 1" > start.sh \ && chmod +x start.sh USER user ENV PATH="/home/user/.local/bin:$PATH" HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost:7860/health || exit 1 CMD ["./start.sh"]