FROM node:22-alpine

WORKDIR /app

# Copy package files
COPY package*.json ./
COPY pnpm-lock.yaml* ./

# Install dependencies
RUN if [ -f pnpm-lock.yaml ]; then \
      npm install -g pnpm && pnpm install; \
    else \
      npm install; \
    fi

# Copy source code
COPY . .

# Expose port
EXPOSE 3001

# Start development server
CMD if [ -f pnpm-lock.yaml ]; then \
      pnpm dev --host 0.0.0.0 --port 3001; \
    else \
      npm run dev -- --host 0.0.0.0 --port 3001; \
    fi

