FROM python:3.9 # Install ollama tool RUN apt-get update && apt-get install -y \ curl \ && curl -fsSL https://ollama.com/install.sh | sh \ && apt-get clean # Create user RUN useradd -m -u 1000 user # Set the working directory WORKDIR /app # Install dependencies COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the rest of the application code COPY --chown=user . /app # Pull the model RUN python -c "import subprocess; subprocess.run(['ollama', 'pull', 'mohamedo/bignova'], check=True)" # Expose port for FastAPI EXPOSE 8000 # Start FastAPI app CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]