rapidpro / rapidpro-base-docker

Base Python 2.7 + geolibs Docker image for building RapidPro
0 stars 4 forks source link

v5 base Image #2

Open tybritten opened 5 years ago

tybritten commented 5 years ago

Since we're already upgraded to 5.x, I'm looking at revving the docker images we're testing with as well. The go service ones (MR, Courier, Indexer, Archiver) are pretty slim to begin with but the main RP one is still big. I'd like to switch to a multistage build, hopefully for both the base as well as the main rapidpro image. @smn I don't know much about these geos libs- can we build them and then transfer them to a final image or do we need all the prereqs?

smn commented 5 years ago

I don't really know to be very honest! We can try and find out. I don't recall offhand which python dependencies require these to be installed. I think @tobiasmcnulty originally put this rapidpro-base-docker thing together.

👍 from me on attempting to switch to a multistage build and just copying the necessary binaries over though.

tybritten commented 5 years ago

yeah I'm looking at this approach: https://blog.realkinetic.com/building-minimal-docker-containers-for-python-applications-37d0272c52f3

I'd love to get the final running image under 1GB 😆

tybritten commented 5 years ago

i'm messing with it right now and if it works, i'll put. a PR in for a v5 folder/dockerfile

tybritten commented 5 years ago

also these are interesting: https://github.com/OSGeo/gdal/tree/master/gdal/docker

do you know how much/which parts of GDAL/GEOS/etc RP uses?

tobiasmcnulty commented 5 years ago

also these are interesting: https://github.com/OSGeo/gdal/tree/master/gdal/docker

Those look potentially helpful!

do you know how much/which parts of GDAL/GEOS/etc RP uses?

I don't, sorry. my gut says just go with whatever is needed for Django (don't try to pare it down too much)...

Semi-related, I soured on Alpine after discovering the strftime bug. I updated an old post recently with my current approach for Django-based Dockerfiles:

https://www.caktusgroup.com/blog/2017/03/14/production-ready-dockerfile-your-python-django-app/

tybritten commented 5 years ago

I like that approach @tobiasmcnulty. What I'm testing now is a combo of that- do the deps/pip installs in a builder stage then just COPY /venv /venv to the run image

smn commented 5 years ago

@tybritten how's v5 + docker working for you ? I've not looked much at these docker builds since v5 was released.

tybritten commented 5 years ago

not much is different from v4. Images sizes are still bigger than I'd like (over 1.1GB even with using the multistage builds) i really can't seem to figure out exactly how much of those GEOS libs etc are needed so i think we can stick with the v4 base for now.