a year ago
hi there i'm trying to build and run a react router v7, seems like it is throwing some kind of error everytime it tries to start the container.
package.json scripts
"scripts": {
"build": "cross-env NODE_ENV=production react-router build",
"start": "cross-env NODE_ENV=production bun ./build/server/index.js",
"dev": "bunx --bun vite",
"typecheck": "react-router typegen && tsc"
},FROM oven/bun:1 AS dependencies-env
RUN bun i -g cross-env
COPY . /app
# [optional] tests & build
ENV NODE_ENV=production
ARG VITE_API_URL
ARG VITE_AUTH_API_URL
ARG VITE_CLOUD_FRONT_URL
ENV VITE_API_URL=${VITE_API_URL}
ENV VITE_AUTH_API_URL=${VITE_AUTH_API_URL}
ENV VITE_CLOUD_FRONT_URL=${VITE_CLOUD_FRONT_URL}
FROM dependencies-env AS development-dependencies-env
COPY ./package.json bun.lock /app/
WORKDIR /app
RUN bun i --frozen-lockfile
FROM dependencies-env AS production-dependencies-env
COPY ./package.json bun.lock /app/
WORKDIR /app
RUN bun i --production
FROM dependencies-env AS build-env
COPY ./package.json bun.lock /app/
COPY --from=development-dependencies-env /app/node_modules /app/node_modules
WORKDIR /app
RUN bun run build
FROM dependencies-env
COPY ./package.json bun.lock /app/
COPY --from=production-dependencies-env /app/node_modules /app/node_modules
COPY --from=build-env /app/build /app/build
WORKDIR /app
CMD ["bun", "run", "start"]22 Replies
a year ago
hello,
completed means that the process has exited, you would need to add more verbose logging to try and figure out why the application exits.
yeah this issue wasnt happending before when i was using pnpm, it went smoothly then, but now i guess something might of got broken in the process
hmm, i mean i wouldnt even know where to log anything since, it breaks when it tries to run the script to be able to start the service
a year ago
hey i wouldnt know either unfortunately
a year ago
just wanted to provide you the context i could
a year ago
you mean the red colour? thats not necessarily an error, its red because it was sent to stderr
a year ago
no worries
i've changed the start script to react-router serve, which allows to create that server, and it worked
a year ago
does that start a production ready server? i wouldnt want you to run a dev server and get a big bill for memory
a year ago
sounds good to me
if i did do a mistake on this matter, i will come back, but everything seems stable
a year ago
sounds good, ill leave this thread open for a few days