# Use Node.js base image instead of Python FROM node:18-bullseye # Create non-root user (to follow HF convention) RUN useradd -m -u 1570 user USER user # Set work directory WORKDIR /app # Copy package files first (for caching installs) COPY --chown=user package*.json ./ # Install dependencies RUN npm install --legacy-peer-deps # Copy all source code COPY --chown=user . . # Build Next.js app RUN npm run build # Expose port 7860 (Hugging Face requirement) EXPOSE 7860 # Run Next.js in production mode, bound to port 7860 CMD ["npm", "run", "start", "--", "-p", "7860"]