Issue with starting service
rv-bit
HOBBYOP

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

rv-bit
HOBBYOP

a year ago

d2723d13-1ff1-43d4-92b3-2e5a34f1f2ae


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.


rv-bit
HOBBYOP

a year ago

hi theree


rv-bit
HOBBYOP

a year ago

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


rv-bit
HOBBYOP

a year ago

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


rv-bit
HOBBYOP

a year ago

got it working, well the error still persists, but i've got the service up


a year ago

you mean the red colour? thats not necessarily an error, its red because it was sent to stderr


rv-bit
HOBBYOP

a year ago

ohh, ok then you know my mind went stright to error, sorry about that then


rv-bit
HOBBYOP

a year ago

🙂


a year ago

no worries


rv-bit
HOBBYOP

a year ago

i've changed the start script to react-router serve, which allows to create that server, and it worked


rv-bit
HOBBYOP

a year ago

so yeah


rv-bit
HOBBYOP

a year ago

thank you very much


rv-bit
HOBBYOP

a year ago

❤️


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


rv-bit
HOBBYOP

a year ago

production


a year ago

sounds good to me


rv-bit
HOBBYOP

a year ago

🙂


rv-bit
HOBBYOP

a year ago

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


Welcome!

Sign in to your Railway account to join the conversation.

Loading...