# Use a small Node.js base image FROM node:18-alpine # Set working directory WORKDIR /app # Copy package files first for caching COPY package*.json ./ # Install dependencies RUN npm install # Copy all files COPY . . # Build the app (this generates 'build' or 'dist' folder) RUN npm run build # Install a lightweight static file server RUN npm install -g serve # Default port (Hugging Face will override this) ENV PORT=7860 # Expose the port EXPOSE 7860 # === IMPORTANT === # For React (CRA): folder is 'build' # For Vite / Vue / Svelte: folder is 'dist' # Uncomment the correct line below: # For React (create-react-app): # CMD ["sh", "-c", "serve -s build -l tcp://0.0.0.0:${PORT}"] # For Vite / Vue / Svelte (most modern setups): CMD ["sh", "-c", "serve -s dist -l tcp://0.0.0.0:${PORT}"]