Webapp service builds twice on every deploy — Docker stage then Nixpacks restart
sbenodiz
PROOP

16 days ago

Service: schools-webapp

Region: europe-west4-drams3a

Builder: Nixpacks (configured in railway.toml)

Root directory: /webapp

Issue: Every deployment appears to build the app twice. Looking at the build logs, I see:

1. A first stage-0 build that runs npm i, copies files, runs npm run build, and completes successfully ("Build time: 225.12 seconds")

2. A ~6 minute gap

3. Then Nixpacks starts a completely new build from scratch — setup nodejs_22, npm i, etc.

This effectively doubles the build time. The initialization/snapshot step also takes 8+ minutes despite the root directory being set to /webapp.

railway.toml:

[build]

builder = "nixpacks"

installCommand = "npm install"

buildCommand = "npm run build"

[deploy]

startCommand = "MALLOC_ARENA_MAX=2 NODE_OPTIONS='--max-old-space-size=768' npm start"

restartPolicyType = "ON_FAILURE"

restartPolicyMaxRetries = 10

healthcheckPath = "/api/health"

healthcheckTimeout = 100

Questions:

1. Why is the app being built twice (once as Docker stage-0 and once via Nixpacks)?

2. Is there a way to ensure only a single Nixpacks build runs?

3. Does the root directory setting (/webapp) affect the snapshot step, or does Railway still clone the full repo?

Solved

1 Replies

16 days ago

Hello,

Can you please link directly to a deployment where you saw this?


Status changed to Awaiting User Response Railway 16 days ago


Railway
BOT

9 days ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 9 days ago


Loading...