Make a start at optimising the backend container image builds#402
Make a start at optimising the backend container image builds#402spwoodcock wants to merge 10 commits intodevelopfrom
Conversation
|
I just broke this by splitting out the pip installs into multiple steps. I think the issue is because the |
|
Sam, I took a look at this to see if I could use it to get my setup running locally. I was able to fix the errors in the build by removing the |
Oh nice, thanks for pointing that out! Another thing I can think of: do you have the latest version of docker and compose installed? To ensure its using a modern version of buildkit. Also, if you set COMPOSE_BAKE=true in your environment, it will use a slightly more efficient builder. But, the key thing we need to do here is possibly be more selective with the dependencies we install. Not sure if its possible to reduce down some of the ML libs or GPU drivers. The quickest solution for you is for me to build and push the image to the registry, then you simply pull. Does that sound ok? (Sorry I haven't got much time to dig into this further personally at the moment, but I think its on @kshitijrajsharma's todo list too) 😄 |
|
I removed the flags, but I still get an error on install: I would assume that Python 3.8 doesn't support the latest version of |
|
Fixed 👍 |
|
Coming back to this :
Perhaps not , the ideal solution would be to take ramp-dependencies out build it in a sep image file and import it our worker docker image , the tensorflow image size is around 3.6gb which https://hub.docker.com/r/tensorflow/tensorflow/tags I am assuming it will take up to 5 gb after gdal and binding ! THIS PR still failing the build of worker , I will investigate what happened ! |
|
haha ! I am reducing the size ! |
|
Closing in favour of #405 |

Issue
This PR
Push the final image to Github container registry, to avoid the lengthy build time for contributors (they can simply pull).EDIT: I foundghcr.io/hotosm/fair_api:develop, so just referenced that instead.The using a squashed multi-stage build shaved off 3GB, making it a total of 16GB now... I didn't get a chance to test it, but I see no reason why things would change (we simply remove the cache / temp files dumped during install). It could probably be optimised further, but I'll need to come back to it in another PR (or someone else could look at it 🙏)
Key question: do we actually need all the deps installed here?
Not included
api-buildandworker-build, where we install only the required dependencies for each.