7 months 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?
1 Replies
7 months 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[bot] • 7 months ago