Nest.js inside monorepo taking around 20 minutes to build
gabrielrangel95
PROOP

2 years ago

Good morning,

I've an API inside a monorepo structure, using yarn workspace, that currently is taking more than 20 minutes to build.

The API is a Nest.js project (standard) and it is inside the monorepo application.

Config on railway:

Builder: Nixpacks

Providers: Node

Custom build: yarn build:api

Watch Paths: /packages/bestbarbers-api/**

Custom start command: yarn start:api:prod

Runtime: Legacy

Resource: 32 vCPU and 32gb memory.

Is there any way to optimize this build?

Solved

1 Replies

2 years ago

Hello,

Looks like the yarn install step is what is taking the longest with a duration of 718.5 seconds.

This is likely installing all dependences for all packages in your monorepo, perhaps you can look into writing a custom Dockerfile for the API that will only install the dependencies for the API app.

You can put that Dockerfile in the applicable location and tell Railway to use it with a RAILWAY_DOCKERFILE_PATH service variable - https://docs.railway.app/guides/dockerfiles#custom-dockerfile-path


Status changed to Awaiting User Response Railway over 1 year ago


Railway
BOT

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


Welcome!

Sign in to your Railway account to join the conversation.

Loading...