FROM oven/bun:latest AS base
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*

# Install root project dependencies
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile

# Install web project dependencies
COPY web/package.json web/bun.lock ./web/
RUN cd web && bun install --frozen-lockfile

# Copy source code
COPY . .

# Expose ports (3000 for web dashboard)
EXPOSE 3000

# Default command
CMD ["bun", "run", "dev"]
