services:
  postgres:
    image: ${POSTGRES_IMAGE:-docker.1ms.run/library/postgres:16}
    container_name: mass-base-db
    restart: unless-stopped
    environment:
      POSTGRES_USER: gpustack
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-gpustack}
      POSTGRES_DB: gpustack
    volumes:
      - postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U gpustack"]
      interval: 5s
      timeout: 5s
      retries: 5

  mass-base-server:
    build:
      context: ..
      dockerfile: pack/Dockerfile
    container_name: mass-base-server
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      GPUSTACK_DATABASE_URL: postgresql://gpustack:${POSTGRES_PASSWORD:-gpustack}@postgres:5432/gpustack
    volumes:
      - mass-base-data:/var/lib/gpustack
    ports:
      - "80:80"

volumes:
  postgres-data: {}
  mass-base-data: {}
