FROM node:20-alpine # Ensure Next.js native binaries work on Alpine RUN apk add --no-cache libc6-compat ENV NODE_ENV=production \ NEXT_TELEMETRY_DISABLED=1 \ PORT=7860 \ NEXT_PUBLIC_SERVER_MODE=false WORKDIR /app # Install deps with cache-friendly layering COPY package.json package-lock.json ./ RUN npm ci --include=dev # Install freebuff globally RUN npm install -g freebuff # Copy source and build COPY . . RUN npm run build EXPOSE 7860 # Run start script that launches freebuff in background and starts app CMD ["/bin/sh", "start.sh"]