Error - Failed to start deployment
halljoshr
HOBBYOP

a year ago

Preface with I am a noob with deploying nextjs, I am generally a python guy. But I am getting this error after railway is trying to deploy my frontend for like 7 minutes. It has nothing in the deploy logs, this is from the build logs.

#16 DONE 0.0s

Oct 17 17:04:10

Oct 17 17:04:10

#15 exporting to image

Oct 17 17:04:10

Oct 17 17:04:14

#15 pushing layers 4.1s done

Oct 17 17:04:14

#15 pushing manifest for us-west1.registry.rlwy.net/47328a15-14f0-4608-aff8-fb851a0b534f:4c266e8a-f023-4a7c-8812-bdd33779cc0f@sha256:a2e1dd826fb86e8d85b3d5b8232efe8e2b95c93e7c9f030ecaaa75f8d927cfdb

Oct 17 17:04:14

Oct 17 17:04:14

#15 pushing manifest for us-west1.registry.rlwy.net/47328a15-14f0-4608-aff8-fb851a0b534f:4c266e8a-f023-4a7c-8812-bdd33779cc0f@sha256:a2e1dd826fb86e8d85b3d5b8232efe8e2b95c93e7c9f030ecaaa75f8d927cfdb 0.7s done

Oct 17 17:04:14

#15 DONE 11.2s

Oct 17 17:04:14

Oct 17 17:04:14

Build time: 64.40 seconds

Oct 17 17:10:12

Oct 17 17:10:12

=========================

Oct 17 17:10:12

Container failed to start

Oct 17 17:10:12

=========================

Oct 17 17:10:12

Oct 17 17:10:12

Failed to start deployment.

Oct 17 17:10:12

If this error persists, please reach out to the Railway team at https://help.railway.app.

This is my Dockerfile if that helps.

FROM node:20-slim AS base

FROM base AS builder

WORKDIR /app

COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci

COPY ./frontend .


ARG NEXT_PUBLIC_API_BASE_URL

RUN npm run build

FROM base AS runner
WORKDIR /app

# Copy the build output from the builder stage
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/package*.json ./

RUN npm install --production

USER nextjs

EXPOSE 3000

ENV PORT=3000

CMD npm run start
Solved

3 Replies

brody
EMPLOYEE

a year ago

In your Dockerfile, you switch to the nextjs user, but you never created that user to begin with, you can just remove that line.


halljoshr
HOBBYOP

a year ago

And that is what you get for copying someone's, messing with it and not knowing 100% what you are doing. Thank you so much!


brody
EMPLOYEE

a year ago

No problem!


Status changed to Solved brody about 1 year ago


Loading...