Issue with starting service
rv-bit
HOBBYOP

10 months 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

10 months ago

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


10 months 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

10 months ago

hi theree


rv-bit
HOBBYOP

10 months 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

10 months 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


10 months ago

hey i wouldnt know either unfortunately


10 months ago

just wanted to provide you the context i could


rv-bit
HOBBYOP

10 months ago

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


10 months ago

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


rv-bit
HOBBYOP

10 months ago

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


rv-bit
HOBBYOP

10 months ago

🙂


10 months ago

no worries


rv-bit
HOBBYOP

10 months ago

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


rv-bit
HOBBYOP

10 months ago

so yeah


rv-bit
HOBBYOP

10 months ago

thank you very much


rv-bit
HOBBYOP

10 months ago

❤️


10 months 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

10 months ago

production


10 months ago

sounds good to me


rv-bit
HOBBYOP

10 months ago

🙂


rv-bit
HOBBYOP

10 months ago

if i did do a mistake on this matter, i will come back, but everything seems stable


10 months ago

sounds good, ill leave this thread open for a few days


Loading...