-
Notifications
You must be signed in to change notification settings - Fork 5
Description
First of all, thank you for making a great package manager like Bun and providing this example repository! It has been a game-changer for my workflow.
I would like to request an official reference Dockerfile for this template that correctly handles the Next.js build and runtime using Bun.
As a developer, I have successfully containerized pure backend applications with Bun without issues. However, getting Next.js to play well with the Bun runtime inside Docker has been a significant struggle.
I have attempted various configurations across different infrastructure providers (VPS, standard Docker runners), but I consistently run into friction between:
- The Vercel/Next.js build output: Which is heavily optimized for Node.js.
- The Bun Runtime: Trying to run the Next.js
standaloneoutput or standard build artifacts often leads to obscure errors regarding missing dependencies, sharp/image optimization glibc issues, or entry point mismatches (server.jsvsbun start).
I am looking for a "Golden Path" Dockerfile added to this repo that demonstrates the Bun team's recommended way to:
- Install dependencies using
bun install. - Build the Next.js app (
bun run build) specifically for a containerized environment. - Crucially: Serve the application in production using the
bunruntime (not falling back tonode), ensuringnext.config.tsand environment variables are respected.
Currently, most community resources or Vercel documentation assume a Node.js runtime for the final container. Having an official example here would solve a lot of headaches for developers trying to move their full-stack Next.js stack entirely to Bun.