igor

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.

Showing Posts 1 to 4

Aetherus

Aetherus

Only Erlang, Elixir and Mix are pre-installed.

If you need to build some C code, build-essential is 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-html options.

igor

igor OP

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

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

igor OP

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.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews