# Test Dockerfile for referral-service
FROM node:20-alpine

WORKDIR /app

# Install build dependencies
RUN apk add --no-cache python3 make g++

# Copy package files
COPY package*.json ./

# Install dependencies
RUN npm ci

# Copy prisma schema
COPY prisma ./prisma/

# Generate Prisma client
RUN npx prisma generate

# Copy source code and tests
COPY . .

# Build the application
RUN npm run build

# Set environment for testing
ENV NODE_ENV=test

# Default command - run all tests
CMD ["npm", "test"]
