You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building my react-router / remix app (in framework mode) using the recommended react-router build command. I am also using Bun. My Dockerfile looks like this:
FROM oven/bun:1 AS base
WORKDIR /usr/src/app
# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile
# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
RUN bunx prisma generate
# build
ENV NODE_ENV=production
RUN bun run build
RUN bun playwright-core install chromium
RUN bun playwright-core install-deps chromium
# copy production dependencies and source code into final image
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app .
# run the app
USER bun
EXPOSE 3000/tcp
ENTRYPOINT [ "bun", "run", "start" ]
The build process fails on the bun run build step with the following error:
> [build-env 4/4] RUN bun run build:
#14 0.240 $ cross-env NODE_ENV=production react-router build
#14 1.555 vite v5.4.11 building for production...
#14 1.709 transforming...
#14 3.604 ✓ 1555 modules transformed.
#14 3.615 x Build failed in 2.01s
#14 3.617 16585 | path$n.dirname(nearestPackage.dir),
#14 3.617 16586 | packageCache
#14 3.617 16587 | ));
#14 3.617 16588 | }
#14 3.617 16589 | function loadPackageData(pkgPath) {
#14 3.617 16590 | const data = JSON.parse(fs__default.readFileSync(pkgPath, "utf-8"));
#14 3.617 ^
#14 3.617 EISDIR: [commonjs--resolver] Is a directory
#14 3.617 errno: -21
#14 3.617 code: "PLUGIN_ERROR"
#14 3.617 syscall: "read"
#14 3.617 fd: 940
#14 3.617
#14 3.617 at readFileSync (native:1:1)
#14 3.617 at loadPackageData (/app/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:16590:38)
#14 3.617 at tryCleanFsResolve (/app/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:46388:22)
#14 3.617 at tryFsResolve (/app/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:46322:14)
#14 3.617
#14 3.702 error: script "build" exited with code 1
------
executor failed running [/bin/sh -c bun run build]: exit code: 1
I can't find much about this online and ChatGPT thinks it has something to do with a misplaced/named package.json file, but I can't find anything like that. Has anyone experienced this? This doesn't happen when I build with yarn.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am building my react-router / remix app (in framework mode) using the recommended
react-router build
command. I am also using Bun. My Dockerfile looks like this:The build process fails on the
bun run build
step with the following error:I can't find much about this online and ChatGPT thinks it has something to do with a misplaced/named package.json file, but I can't find anything like that. Has anyone experienced this? This doesn't happen when I build with yarn.
Beta Was this translation helpful? Give feedback.
All reactions