I finally found out what the problem was. Or at least part of the problem.
The thing was that the tmp/
directory within my local rails app had grown to be very big, about 5.5 GB in size. Files within the tmp/
directory are supposed to be ignored when sending the context to build the docker image. However, there seems to be a bug in the .dockerignore
file that is autogenerated by fly
during fly launch
that is causing all the files in the tmp/
directory to be sent as context to the docker image, causing the image to become huge (5.5 GB). Why was this big image failing to be pushed to the fly registry? that, I don’t know, probably some size limit somewhere in fly since the push kept restarting after having pushed about 3.5 GB of the image to the registry.
This is the bug in the .dockerignore
file generated by fly
:
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/ # <-- bug: This line should be deleted, is basically making the previous line useless, all files inside /tmp/pids are being sent to the context
!/tmp/pids/.keep
# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/ # <-- bug: This line should be deleted, is also making the previous line useless, all files inside /tmp/storage are being sent to the context. This directory had 5.5 GB of data in my case.
!/tmp/storage/.keep
After removing those lines from the .dockerignore
my app went down to 490 MB, and was finally deployed successfully.