NextJs 16.1.1 docker bun deployment issues (very slow production app)
florjanklancar
HOBBYOP

23 days ago

Hey everyone I'm new to the channel and to railway platform and I'm having issues with my NextJS app being very slow in production it almost feels like the development server is running in production build - even static site pages are taking 1-3seconds to load…
This is my configuration I have a monorepo of a few services and a nextjs @web package:
//apps/web/package.json

  "name": "@paydocs/web",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev -p 3000",
    "build": "next build",
    "start": "bun server.js",
    "type-check": "tsc --noEmit"
  },
  "dependencies": {
   ...
    "next": "16.1.1",
   ...
  },
  "devDependencies": {
   ...
  }
}

5 Replies

florjanklancar
HOBBYOP

23 days ago

this is my docker file discord does not allow me to copy and paste…

1461449136179122391


florjanklancar
HOBBYOP

23 days ago

these are my settings if i use this build command the application crashes with:


florjanklancar
HOBBYOP

23 days ago

1461449667706622200
1461449668293562600


florjanklancar
HOBBYOP

23 days ago

if i remove the Custom Start Command the application builds but its very slow


florjanklancar
HOBBYOP

23 days ago

  "build": {
    "builder": "dockerfile",
    "dockerfilePath": "apps/web/Dockerfile",
    "context": ".",
    "buildArgs": {
      "DATABASE_URL": "$DATABASE_URL",
      "NEXT_PUBLIC_SUPABASE_URL": "$NEXT_PUBLIC_SUPABASE_URL",
      "NEXT_PUBLIC_SUPABASE_ANON_KEY": "$NEXT_PUBLIC_SUPABASE_ANON_KEY",
      "NEXT_PUBLIC_APP_URL": "$NEXT_PUBLIC_APP_URL",
      "NEXT_PUBLIC_API_URL": "$NEXT_PUBLIC_API_URL",
      "NEXT_PUBLIC_POSTHOG_KEY": "$NEXT_PUBLIC_POSTHOG_KEY"
    }
  },
  "deploy": {
    "numReplicas": 1,
    "restartPolicyType": "ON_FAILURE",
    "restartPolicyMaxRetries": 10
  }
}

Loading...