services:
  ollama:
    build: .
    image: localhost/ollama-server:latest
    ports:
      - "11434:11434" # Map host port 11434 to container port 11434 (Ollama default)
    volumes:
      - ./models:/models # Mount a local directory for models
      - ollama_data:/usr/share/ollama/.ollama # Persistent storage for Ollama data
    container_name: ollama-server
    environment:
      - OLLAMA_HOST=0.0.0.0
    restart: unless-stopped
    # Uncomment the following lines if you have NVIDIA GPU support
    # deploy:
    #   resources:
    #     reservations:
    #       devices:
    #         - driver: nvidia
    #           count: all
    #           capabilities: [gpu]

  postgres:
    image: pgvector/pgvector:pg17
    container_name: ollama-postgres
    ports:
      - "54320:5432"
    environment:
      - POSTGRES_PASSWORD=postgres
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
    restart: unless-stopped

volumes:
  ollama_data: