Docker Community Forums

Share and learn in the Docker community.

Building binaries against what's in a docker image


(Spencertaylorparkin) #1

Let me give the entire back-story to this docker question…

I’ve been working on a web-app…

https://sym-grp-puz.herokuapp.com/

Yes, it’d dumb. But I’m writing it as an exercise in learning web/cloud technologies. Anyhow, one of my dependencies is a .PYD file that is built against the Python C API; or, more specifically, against the .LIB and .H files that come with the Python installation that I’m using to test my application. It all works great. However, it doesn’t work when I deploy my application to Heroku. Why? Because all pieces of my application are portable, except for the .PYD file. Here comes Docker to save the day, right?!

Well, as you can see from my git history at…

…I’ve been able to create a Dockerfile based upon the official Python (3.6.6) release installed on Window Server Core 2016. And guess what?! It works! I can run my app in a docker container. It’s awesome. BUT…my .PYD file still doesn’t load. Why? Because, I suspect, the .PYD binary needs to be built against the Python installation that is in the docker image.

So, finally, here’s the question… How do I do that?

One thought is to make my own VM with Windows Server Core 2016 running on it, install Python 3.6.6 and VisualStudio, and then compile my .PYD module on the VM, and then hope it’s loadable when added to the docker image I create. But is this the right work-flow? How was the Python docker image created in the first place? Is there a way I can connect to the VM hosting the Python docker image container and then work in developing/building the .PYD inside that VM?


(Spencertaylorparkin) #2

It would be nice if someone could give me a run-down on best practices/workflows or whatever, but in any case, I have resolved my issue.

There was nothing wrong with me building my windows binary on any OS as long as it was against the right version of Python (3.6.6). The problem I had is that I was not also packaging up the C++ run-time dependencies along with the .PYD file in the docker image. After adding VCRUNTIME140.dll and another (I forget the name), my docker container works. Yay!

Now comes the problem of trying to see if I can get it to work on Heroku. I’m not sure if Heroku can accept windows-based docker containers. Does anyone know?