# Stage 1: Build FROM node:latest AS builder WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build # Expose the port your app runs on EXPOSE 7860 # Stage 2: Serve FROM node:alpine WORKDIR /app COPY --from=builder /app/.next ./.next COPY --from=builder /app/public ./public COPY --from=builder /app/package.json ./package.json RUN npm install next CMD ["npm", "start"]