# --- STEP 1: Build Stage --- FROM node:20 AS builder # Enable pnpm RUN corepack enable && corepack prepare pnpm@latest --activate WORKDIR /app # 1. Copy package files COPY package.json pnpm-lock.yaml* ./ # 2. IMPORTANT: Copy the patches folder so pnpm can find the wouter patch COPY patches/ ./patches/ # 3. Install dependencies RUN pnpm install --no-frozen-lockfile # 4. Copy the rest of the source code COPY . . # 5. Build the frontend (Vite) RUN pnpm run build # --- STEP 2: Runtime Stage --- FROM node:20-slim WORKDIR /app # Copy everything from the builder stage COPY --from=builder /app . # Hugging Face Spaces must listen on port 7860 EXPOSE 7860 ENV PORT=7860 ENV NODE_ENV=production # Start the application CMD ["npm", "start"]