Phoenix Docker Example

A demo showing how to run a Phoenix app within a docker container
Alternatives To Phoenix Docker Example
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
a year ago158mitElixir
Open-source live customer chat
3 days ago12otherElixir
Changelog is news and podcast for developers. This is our open source platform.
Szt Bigdata1,702
10 months ago15otherScala
Api For Open Llm841
5 days ago14apache-2.0Python
Openai style api for open large language models, using LLMs just as chatgpt! Support for LLaMA, LLaMA-2, BLOOM, Falcon, Baichuan, Qwen, Xverse, SqlCoder, CodeLLaMA etc. 开源大模型的统一后端接口
4 days ago130Elixir
Codebattle - Game for programmers, where you solved algorithmic problems with other players in real time. You can fight with other players in single player mode or join massive tournaments.
Mix_docker3361835 years ago9June 23, 201715mitElixir
Put your Elixir app production release inside minimal docker image
Docker Phoenix240
4 months ago3gpl-3.0Makefile
A dockerized Phoenix development and runtime environment.
Docker Web Framework Examples207
2 years agomitElixir
Example apps that demonstate how to use Docker with your favorite web frameworks.
Docker Phoenix Example184
19 days ago1mitElixir
A production ready example Phoenix app that's using Docker and Docker Compose.
Learn Docker170
4 years ago9Dockerfile
:ship: Learn how to use containers to consistently deploy your apps on any infrastructure.
Alternatives To Phoenix Docker Example
Select To Compare

Alternative Project Comparisons


This is an example of packaging and running a Phoenix application with docker.

Quick start:

$ make
$ docker run -p 8001:8001 webexample


The build process works as follows:

  • clone this repo to docker/webexample
  • build a docker image named webexample using docker/ as the context

Caveat: there is currently one unresolved problem with getting mix dependecies to build as part of the image build process. If you are getting build errors, run MIX_ENV=prod mix deps.compile once inside docker/webexample on your host machine.

If you are running docker inside a VM, you may need to perform a few additional steps manually. One of them is adding a port forwarding rule in the VM settings to map a port from the VM to the host OS.

Note that it is OK to hardcode the port number used inside the image the way we did. When you run the image, you can map the container port to any other available port on the host (or the VM in the case when docker itself is running in a VM).

Points of interest

Elixir dependencies

The current setup fetches dependencies before building the docker image to speed up the rebuild process. Depending on how you are planning to use docker, you might want to include that as part of the image build or, alternatively, add a rule to the Makefile that will run mix deps.update --all after pulling the latest changes with git.

Iterative development

An important thing to understand about this example: it demoes how one would package an Elixir app in a docker image for deployment. This works fine if you don't need to rebuild the image too often. This workflow differs in a number of ways from using docker as part of the development process.

For the latter case you will have to come up with ways to make docker automatically pick up the latest version of your project's code and update any other environment settings in the presences of code changes. You could mount the directory with your project code as a host volume in the running docker container (passing the -v option to docker run). That implies building the project either when the container starts or beforehand.

Alternative build strategies

With docker it is possible to create "builder images". Those are images that produce build artifacts when run. You could create such an image for your project to have the compilation and running phases separate but still using the same environment and Elixir versions (enforced via a single base image). This workflow is not explored in the present demo.

Popular Docker Projects
Popular Phoenix Framework Projects
Popular Virtualization Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Docker Image