Build bundles - should there be node_modules in them?


#1

Hi Folks. Currently trying to get a build bundle that I can make into a docker image. I’m able to create one but am having trouble finding information about exactly what should be in the bundle.

For instance the bundle is weighing in at 366MB and most of this space seems to be in node_module folders (programs/server/npm/node_modules, programs/server/assets/app/node_modules, programs/web.browser/app/node_modules).

Am I being thick in that I thought “meteor build” would concatenate all the files down to single packages? Are the node_modules required to run the app?

If you are running a deployed meteor app in docker, what size are your docker images (i’m using node-alpine as a base image)? node-alpine is 40MB and my meteor image is 699MB which seems a bit excessive.

Yours hopefully


#2

I think so. I took a look at my two apps, they’re 139M and 199M


#3

I eventually managed to slim the image size down a bit by using --squash as a build option in docker. I don’t ever see there being much layer reuse from version to version so I happy to go with the smaller image size.

I did notice that it was copying a lot of usless files to the some folders in the bundle. These were mostly .d.ts and readme files but are completely unecessary after compiling the typescript so I am removing the programs/server/assets/app/node_modules & programs/web.browser/app/node_modules folders from my bundle before creating the image. It’s not a massive saving but anythings a bonus.

My image size in now 381MB after squashing which is down from 699MB.