services:
  download-model:
    image: alpine:latest
    container_name: download-embedding-model
    volumes:
      - model_storage:/models
    command: >
      sh -c "if [ ! -f /models/snowflake-arctic-embed-m-v1.5-f16.gguf ]; then
        wget --no-check-certificate 'https://huggingface.co/Snowflake/snowflake-arctic-embed-m-v1.5/resolve/main/gguf/snowflake-arctic-embed-m-v1.5-f16.gguf' -O /models/snowflake-arctic-embed-m-v1.5-f16.gguf;
      fi"
    networks:
      - arc-network

  embedding-server:
    image: ghcr.io/ggml-org/llama.cpp:server
    container_name: embedding-arc
    volumes:
      - model_storage:/models
    ports:
      - "8002:8080"
    command: "-m /models/snowflake-arctic-embed-m-v1.5-f16.gguf --embedding --host 0.0.0.0 --port 8080"
    restart: unless-stopped
    networks:
      - arc-network
    depends_on:
      download-model:
        condition: service_completed_successfully

  download-gemma:
    image: alpine:latest
    container_name: download-gemma-model
    volumes:
      - model_storage:/models
    command: >
      sh -c "if [ ! -f /models/gemma-4-E4B-it-UD-Q4_K_XL.gguf ]; then
        wget --no-check-certificate 'https://huggingface.co/unsloth/gemma-4-E4B-it-GGUF/resolve/main/gemma-4-E4B-it-UD-Q4_K_XL.gguf' -O /models/gemma-4-E4B-it-UD-Q4_K_XL.gguf;
      fi"
    networks:
      - arc-network

  gemma-server:
    image: ghcr.io/ggml-org/llama.cpp:server
    container_name: gemma-arc
    volumes:
      - model_storage:/models
    ports:
      - "8003:8080"
    command: "-m /models/gemma-4-E4B-it-UD-Q4_K_XL.gguf --host 0.0.0.0 --port 8080 -c 8192"
    restart: unless-stopped
    networks:
      - arc-network
    depends_on:
      download-gemma:
        condition: service_completed_successfully

volumes:
  model_storage:

networks:
  arc-network:
    external: true