x-common: &common
  volumes:
    - ./:/app
    - pnpm-store:/pnpm/store
    - ../libvirt:/libvirt
  environment:
    - IS_DOCKER=true
    - GIT_SHA=${GIT_SHA:-unknown}
    - IS_TAGGED=${IS_TAGGED:-false}

services:

  dev:
    image: unraid-api:development
    ports:
      - "3001:3001"
    build: 
      context: .
      target: development
      dockerfile: Dockerfile
    <<: *common
    stdin_open: true
    tty: true
    entrypoint: /bin/bash
    profiles:
      - builder

  local:
    image: unraid-api:development
    ports:
      - "3001:3001"
    build: 
      context: .
      target: development
      dockerfile: Dockerfile
    <<: *common
    command: npm run start:dev
    profiles:
      - builder

  builder:
    image: unraid-api:builder
    build: 
      context: .
      target: builder
      dockerfile: Dockerfile
    <<: *common
    profiles:
      - builder

volumes:
  pnpm-store:
    name: "pnpm-store"
  pnpm-cache:
    name: "pnpm-cache"