woohaaha

woohaaha

Shipping Phoenix with Python in one Docker container for Machine Learning

Howdy all :wave:

I’d like to ship a Phoenix application that can call Python libraries. There are a few threads on this topic however packaging all the frameworks/libraries into 1 docker container (in general) does not appear to be so common (for “reasons” of course).

In any case, I’d like to do so. Just as Elixir releases create a single unit or bundle I “think” PyInstaller can do the same thing for a Python app/lib.

Ideally the final stage of my Dockerfile would copy the Elixir release and the Python release into the final container and therefore my Phoenix app could call to the python app (via ports or http).

Can this be done?
Has anyone done this?
Are there any gotchas I should know about? (aside from multi-app complexity in one container)
Are there Dockerfiles that people recommend for doing this?

Thank you for any feedback

Most Liked

chulkilee

chulkilee

I don’t know how easy to copy a python environment… (compared to copying elixir release)… but you can do it with multi-stage docker build

  • build python part in python stage
  • build elixir part in elixir stage
  • in final stage - install runtime dependencies (e.g. SSL, any dynamic linked libraries), and copy both python and elixir parts from each stage.

How do you want to make them communicate? If you want to use http (e.g. from elixir phoenix app to python web server) - then it’s more “conventional” to have separate containers - for example Kubernetes makes it easy to run two containers in the same network by having multiple containers in a pod.

Where Next?

Popular in Questions Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
gonzofish
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement