Open pdr-999 opened 1 year ago
the command bun run build
was not executed.
I believe I am having a similar issue
Same problem, bun run build
doesn't work correctly inside docker
Same issue, nextjs + docker build fails. Probably memory issue but could not find any equivalent for --max-old-space-size in Node.js yet. (While running locally, there is no issue with build. v1.0.0)
Why create the build in docker? Why not build it outside of docker, copy it, and then just bun run
in docker?
In my specific instance, I am trying to get Next.js 13 to work with Bun on Railway. The build seems to complete successfully with no errors (although the next js file structure output is strangely missing from the console. Could be a red herring tho). However, the problem arises when the command bun run start is executed as I get the following issue:
$ next start
- ready started server on localhost:7988, url: http://localhost:7988/
ENOENT: No such file or directory
path: "/app/.next/BUILD_ID"
syscall: "open"
errno: -2
the command
bun run build
was not executed.
In my case it did execute successfully but the output was incomplete, from this snippet of
docker compose build app-bun --progress=plain --no-cache
logs, it finishes before generating any pages. The output is usually Generating static pages (4/4)
, Finalizing page optimization.....
after Creating an optimized production build
, etc, instead it finishes.
#9 [5/5] RUN bun run build
#9 0.561 $ next build
#9 0.590 - warn You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env
#9 1.229 Attention: Next.js now collects completely anonymous telemetry regarding usage.
#9 1.229 This information is used to shape Next.js' roadmap and prioritize features.
#9 1.229 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
#9 1.229 https://nextjs.org/telemetry
#9 1.229
#9 1.378 - info Creating an optimized production build...
#9 DONE 8.3s
Why create the build in docker? Why not build it outside of docker, copy it, and then just
bun run
in docker?
Most Dockerfile examples with node builds in docker, https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile so I tried replacing node with bun.
Installing outside of docker defeats the purpose of using docker in a server no?
But shouldn't it have the same output either way?
Facing the same issue here. Managed to bypass it by using a Node image in the build stage.
# syntax=docker/dockerfile:1
ARG BUN_VERSION=1.0.0
FROM oven/bun:${BUN_VERSION} as base
WORKDIR /app
ENV NODE_ENV=production
FROM base as deps
COPY package.json bun.lockb ./
RUN bun install
FROM node:18 as build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build -- --no-lint
FROM base as final
USER bun
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/.next ./.next
COPY --from=build /app/public ./public
EXPOSE 3000
CMD ["bun", "run", "start"]
Facing the same issue here. Managed to bypass it by using a Node image in the build stage.
# syntax=docker/dockerfile:1 ARG BUN_VERSION=1.0.0 FROM oven/bun:${BUN_VERSION} as base WORKDIR /app ENV NODE_ENV=production FROM base as deps COPY package.json bun.lockb ./ RUN bun install FROM node:18 as build WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . RUN npm run build -- --no-lint FROM base as final USER bun COPY --from=build /app/package.json ./package.json COPY --from=build /app/node_modules ./node_modules COPY --from=build /app/.next ./.next COPY --from=build /app/public ./public EXPOSE 3000 CMD ["bun", "run", "start"]
Same issue
next.js build with bun in Docker fails with following error: script "build" exited with code 9 (SIGKILL)
Same issue here
same issue as @aak-lear. any update?
Also having this issue running bun --bun run next build
the same issue for me
What version of Bun is running?
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983
What platform is your computer?
Linux 6.2.0-32-generic x86_64 x86_64
What steps can reproduce the bug?
What is the expected behavior?
bun-nextjs | - ready started server on [::]:3000, url: http://localhost:3000
What do you see instead?
bun-nextjs | - warn You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env bun-nextjs | - ready started server on localhost:3000, url: http://localhost:3000 bun-nextjs | ENOENT: No such file or directory bun-nextjs | path: "/app/.next/BUILD_ID" bun-nextjs | syscall: "open" bun-nextjs | errno: -2
Additional information
Docker version: Docker version 23.0.3, build 3e7cbfd
When running
.next contents of docker + nextjs + node
.next contents of docker + nextjs + bun
tldr: Running