# creates the docker compose

# build individual services 
services:
  # setup discord bot container
  discord:
    build: ./                     # find docker file in designated path
    container_name: discord
    restart: always               # rebuild container always
    image: gitea.matrixwide.com/alex/discord-aidolls:0.1.0
    environment:
      CLIENT_TOKEN: ${CLIENT_TOKEN}
      OLLAMA_IP: ${OLLAMA_IP}
      OLLAMA_PORT: ${OLLAMA_PORT}
      REDIS_IP: ${REDIS_IP}
      REDIS_PORT: ${REDIS_PORT}
      MODEL: ${MODEL}
    networks:
      ollama-net:
        ipv4_address: ${DISCORD_IP}
    volumes: 
      - discord:/src/app          # docker will not make this for you, make it yourself

# setup redis container
  redis:
    image: redis:latest
    container_name: redis
    restart: always
    networks:
      ollama-net:
        ipv4_address: ${REDIS_IP}
    volumes:
      - redis:/root/.redis
    ports:
      - ${REDIS_PORT}:${REDIS_PORT}

# create a network that supports giving addresses withing a specific subnet
networks:
  ollama-net:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: ${SUBNET_ADDRESS}/16

volumes:
  discord:
  redis:
