| FROM node:18-slim | |
| WORKDIR /app | |
| # Install dependencies first (for build cache efficiency) | |
| COPY package*.json ./ | |
| # Install all dependencies including dev so Vite is available during build and preview | |
| RUN npm install | |
| # Copy the rest of the source code | |
| COPY . . | |
| # Ensure non-root user (UID 1000) can write to the app directory at runtime (HF Spaces runs with uid 1000) | |
| RUN chown -R 1000:1000 /app | |
| # Switch to the non-root user | |
| USER 1000 | |
| # Default port for Hugging Face Spaces Docker runtime | |
| ENV PORT 7860 | |
| EXPOSE 7860 | |
| # Start the app – this script builds then serves via Vite preview on $PORT | |
| CMD ["npm", "run", "dev"] |