Apparently, the fly cli/fly deploy is putting the devDependencies from the package.json file into the container image.
When I remove the devDependencies from the package.json file the image size drops from around 300 MB to 260 MB. I did this two times in the same project to confirm that.
Putting node_modules in .dockerignore will avoid copying node_modules from a local directory to the container image, but Dockerfile could still install devDependencies.
Once flyctl creates Dockerfile, that’s yours and you can change that whatever you want. It would be better to edit your Dockerfile, rather than getting rid of devDependencies from package.json. Your “for development” dependencies should be locked by package.json along with production dependencies.
That’s not the latest. If you were to update your flyctl and relaunch you will get a better Dockerfile which will produce a significantly smaller image. Alternately, you can add --omit dev to the npm install line