Reducing Coolify deployment time by ~80%
TL;DR : Switching from Nixpacks or Railpack to a custom Dockerfile for my stack reduced by more than 80% the build and deploy of my blog.
| Builder | Deploy time (seconds) |
|---|---|
| Nixpacks | ~180 |
| Railpack | ~120 |
| Custom Dockerfile | ~35 |
I use a VPS and Coolify in order to host this very blog. It’s a static Astro blog, which is deployed by a webhook when I push on my github.
For the deployment I used at first the default Nixpacks setup with type of site static. This default setup build and deploy 280 article from my blog in ~2min40s to ~3min15s… 3 min. It’s AN ETERNITY !!!
After an update from Coolify, I had another options to choose from, Railpack, the successor to Nixpacks, a more modern and faster alternative. The switch was easy I just selected it inside the Coolify panel. The deploy still took ~2min, 1 minute down but still slow for me.
The main issue for the slowness was the default configuration. For each build, they had to check my code in order to guess my stack and choose the right build and deploy correctly.
I am a developer and I am in control of the entire stack, so I decided to use a custom DockerFile which will respond only to my needs.
So I decided to use a custom DockerFile to respond only to my need and not guessing each time. Here is the commit 1 and commit 2. With the first version I got to ~2minutes to ~50s, when I used alpine slim because I don’t need all the alpine stuff I got down to nearly ~30s.
I really love optimizing stuff ( I wrote a thesis about web performance ), I put this optimization behind me for a long time. But with AI, I finally took the time to do it properly.
Now, every time I write an article from my computer, it’s live nearly 30 seconds after my push ! Usable finally.