igor
Hi, everyone!
If I want to develop a Phoenix project and build a release specifically for Ubuntu 18.04 (bionic), Erlang 22 and Elixir 1.10.2 in Docker container and I’m looking for an image to base my Dockerfile from what is my best option?
I’ve read a topic on this forum that hexpm published docker images for all erlang and elixir versions. I went to docker hub and found hexpm/elixir:1.10.2-erlang-22.2-ubuntu-bionic-20200219 image.
Seems exactly what I need, but I’m not sure because in the description of the image I don’t see what’s installed, the layers add some file and copy some dir, that’s basically it.
The link to the image: Image Layer Details - hexpm/elixir:1.10.2-erlang-22.2-ubuntu-bionic-20200219
Besides Elixir code I need to build some c code in the container (bcrypt is used) and a webpack stuff for Phoenix, so is it enough to just make a Dockerfile like this:
FROM hexpm/elixir:1.10.2-erlang-22.2-ubuntu-bionic-20200219
RUN apt-get update && \
apt-get install -y postgresql-client && \
apt-get install -y inotify-tools && \
apt-get install -y nodejs && \
curl -L https://npmjs.org/install.sh | sh && \
mix local.hex --force && \
mix archive.install hex phx_new 1.5.3 --force && \
mix local.rebar --force
ENV APP_HOME /app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
CMD ["mix", "phx.server"]
or I should add more tooling? Or I shouldn’t use this image for my purpose and start building my image from scratch? I’m new to docker, so have many doughts.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Aetherus
Only Erlang, Elixir and Mix are pre-installed.
If you need to build some C code,
build-essentialis what you want in the building-stage image. (you don’t want it in your running-stage image.)You also need to install nodejs <= 10.x and npm in the building-stage image unless you generated your Phoenix app with the
--no-webpack --no-htmloptions.igor
Thank you for a reply, Aetherus! I’ve added build-essential installation step to my Dockerfile but to test my containerized app I still need to figure out how to add a postgres database for the app to communicate to. As soon as I get it out of my way, I’ll come back here to report the results.
aimerib
You can certainly add postgresql to your dependencies (just follow the postgresql docs on how to install it in Debian/Ubuntu but inside your Dockerfile), but even for a development environment that is not super ergonomic. You might want to look at docker-compose which would allow you to use a postgres image that is pre-built and configured for quick use.
If you want a few pointers for where to look I’d be happy to point you in the right direction, but if you just want a quick start you can Google something like “Phoenix postgres docker-compose” and find a few solid guides to get started
igor
Thank you for help! By the way, in my Dockerfile I added a postgres client, not a server, I’ll follow your advise and add a docker-compose.yml file with a postgres service.