uvicorn-gunicorn-docker icon indicating copy to clipboard operation
uvicorn-gunicorn-docker copied to clipboard

Build containers for multiple architectures

Open tedivm opened this issue 4 years ago • 10 comments
trafficstars

This switches the build+push to using buildx, which in turn is building for amd64, arm64, and arm v7. This shouldn't change the amd64 containers in any way, but will allow users running on OSX M1 chips or AWS Graviton to use native containers instead of the qemu bridge (which segfaults a lot on the new m1 chips).

Once merged I'll make a PR to the FastAPI containers as well, but that requires these containers already be published.

tedivm avatar Sep 23 '21 15:09 tedivm

You can see how it looks on docker hub here (my local test is still running so tags will keep popping up until it's done)- https://hub.docker.com/repository/docker/tedivm/uvicorn-gunicorn

tedivm avatar Sep 23 '21 16:09 tedivm

Thank you so much for doing this. Significantly simplifies our dev workflow for M1 machines.

mayteio avatar Sep 23 '21 23:09 mayteio

Update: the slim containers are building for all architectures now, using a multistage approach that builds the dependencies in one container (the python full container) and then copies them into the new container.

tedivm avatar Sep 27 '21 14:09 tedivm

All of the images (slim, alpine, etc) are now up in my docker hub account for testing (I don't have anything running to keep them up to date, as they only exist for this PR, so please don't use them in any prod environment).

tedivm avatar Sep 27 '21 15:09 tedivm

Is there anything we can do to get this merged/deployed? 🙏

vincentsarago avatar Oct 04 '21 12:10 vincentsarago

+1 for deployment. Thanks!

Matthieu-Tinycoaching avatar Oct 04 '21 14:10 Matthieu-Tinycoaching

Okay for anyone interested I have a repo and set of containers up for a straight uvicorn multiarch build.

It does not use gunicorn, making it a better candidate for tossing into nomad/ecs/kubernetes. It does install uvicorn, including building uvloop for the architectures that don't have a wheel. It uses the same prestart script setup, as well as the same envvars and locations for setting your python modules.

I'll get a readme up later today.

tedivm avatar Oct 05 '21 18:10 tedivm

Another update- I kind of went a bit wild, created a new organization with a variety of github actions to make managing containers easier.

As a result I have a new uvicorn container. This container has a much more in depth tagging structure that allows you to select a Python Version, Variant (full, slim, alpine), and now a package version (instead of just having the most recent version). This ends up building 150 containers each run now (like I said, I went wild) each of which supports three architectures (for a total of 450 builds). The github actions make it so when new versions are released the workflow automatically updates, with the repository supporting the last 10 versions of each package. Even the readme files get automatically updated.

I plan on adding a lot more containers now that I've got a framework for building them.

tedivm avatar Oct 26 '21 01:10 tedivm

The new organization now has the following multi platform images-

They're pretty stable now should anyone want to use them.

tedivm avatar Nov 01 '21 13:11 tedivm

That would close #47 .

codespearhead avatar Mar 17 '24 14:03 codespearhead