Very long build and deploy time using Nixpacks compared to Docker
alex73630
PROOP

a year ago

Project ID: 1ad2e8d9-d8df-4cd2-aca2-4be43f7219d3
Environment ID: d579dbb9-e696-4beb-bbb5-84e1c176d53f

I'm currently experimenting on our backend deployments to try to improve build and deployment time and I'm noticing a huge difference between Nixpacks and Docker deployments.

Nixpacks-based deployment:

  • Time to build: 3:32min

  • Time to deploy: 1:34min

  • Time between build log last line and pre-deploy first line: 1:03min

Docker-based deployment:

  • Time to build: 1:00min (no cached layers)

  • Time to deploy: 0:35min

  • Time between build log last line and pre-deploy first line: 0:15min

This is a Turborepo monorepo with a Express-based backend and a few internal packages loaded.
The build time in Nixpacks is mostly spent outside of the actual Turborepo build and the yarn package install (which is actually pretty fast for that repo size).

My main thought would be around build image size, my Dockerfile being a multi-stage build with an output size of 405MB, including only the backend dependencies and extra packages for the database migration tools.
I don't know any way to see what's the situation over Nixpacks but I suppose it keeps all the monorepo packages in the final image, which Yarn indicates to be around 1.26GiB (thanks Expo/React Native).

From that, I have those questions:

  • Is this a normal/expected behavior?

  • Is my hypothesis correct/plausible?

  • What's recommended between Nixpacks and Docker images in terms of integration with Railway (monitoring, serverless/sleep mode, …)?

Thanks!

Solved

15 Replies

a year ago

  1. unfortunately yes, nixpacks doesn't do any steps, pruning, etc

  2. yes 100%

  3. absolutely no difference, you dont lose any platform features with a dockerfile, so no recommendations, just whatever works best for your needs


alex73630
PROOP

a year ago

Thanks for the quick response!
Dockerfile it is then 😄


alex73630
PROOP

a year ago

I just need to fix my predeploy script so it can wake up my Posgres instance on dev environments ^^


a year ago

you could also just add connection retires into your code?


alex73630
PROOP

a year ago

Also, it seems like Nixpacks wasn't able to do any caching where the Dockerimage is able to, so I'm good for it!


alex73630
PROOP

a year ago

Drizzle doesn't seem to support it on their CLI


a year ago

fair enough


a year ago

good thing we are well underway on alterative solutions 😉


alex73630
PROOP

a year ago

But I can use pg_isready instead. Ping was working on Nixpacks but not on Docker (for some reason it doesn't have the perms, probably Alpinelinux)
So in any case, I'll actually have a more reliable way to know if my DB is ready than just pinging it 😄


alex73630
PROOP

a year ago

Something related to… Performance ?


a year ago

makes sense


a year ago

indeed


alex73630
PROOP

a year ago

We can close this thread, I have all the infos I need 👍
Have a great day 👋


a year ago

you as well!


a year ago

!s


Status changed to Solved brody about 1 year ago


Loading...