How can I speed up my build time?
Each build takes roughly like 4 minutes. I'm testing on prod so it makes my iterations kinda slow.
33 Replies
Project ID:
893df018-6917-4ca3-b43d-6db80b4819ca
Railway
404 - Page not found
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
how big is the image?
also why compile and minify your .ts file? bun has first class support for ts
because this is production and that's much more performant
how long does that specific command take when building?
100ms
how long does railway say it took
the docker file itself is finished in 12s
but the image is quite big
idk why
yes, how big
keep in mind i cant read your logs for you
1 layer = 99.96MB
another layer = 715.2MB
even then it says it only taks 124s tho
thats big, do you need node during the runtime?
not after i've compiled the executable from bun, i don't think i need anything at that point
big images take a seemingly exponentially longer time to deploy and there is some awsome fixes in the pipeline for that
but until then, the only fix would be to write a better dockerfile
can I clear the entire image after i compile the executable?
in more words, yes, you will want to look into multi layered images
oh wait, yeah, that makes sense
the executable is the 700mb
it's every package
you are like 10% of the way there with -
yeah but if I'm making an executable each time it'll be different
so you can't save it as layers
so i just have to tank the performance hit i thikn
Solution
nope, please look into multi layered dockerfiles
how do i do a multi-layered dockerfile with a binary executable?
since it itself will alwasy be ~700mb and changing
get the idea?
while i agree that will help, I don't think that solves the core issue
i think the biggest time sink is that the 700mb executable is being uploaded every time
the build step itself doesn't take that long
are we talking about the node executable?
no, the bun compiled executable of my server
its actually 700mb?? where is this number coming from?
no the compiled executable is only 70mb, idk where the rest is coming from
hvaen't dug into it yet
then it's coming from node and everything else in the image that isn't needed
^
^
will look into
ty