# Use an official Python runtime as a parent image FROM python:3.9-slim # Set the working directory in the container WORKDIR /app # Copy the current directory contents into the container at /app COPY . /app # Install any needed packages specified in requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Install Docker CLI to enable docker-compose commands RUN apt-get update && apt-get install -y docker.io # Create the directory for Ollama with the correct permissions RUN mkdir -p /home/user/.ollama && chown -R 1000:1000 /home/user/.ollama # Switch to a non-root user USER 1000:1000 # Make port 5000 available to the world outside this container EXPOSE 5000 # Run app.py when the container launches CMD ["python", "app.py"]