So I have a fairly simple Dockerfile that looks like:
FROM elixir:latest
RUN mkdir /app
COPY . /app
WORKDIR /app
RUN mix local.hex --force
RUN mix deps.get --only prod
RUN MIX_ENV=prod mix compile
RUN mix phx.digest
#RUN MIX_ENV=prod mix ecto.create
#RUN MIX_ENV=prod mix ecto.migrate
CMD MIX_ENV=prod mix phx.server
I am using Argon2, and on my dev server I see this error when it tries to encrypt a password:
[error] Process #PID<0.402.0> raised an exception
** (RuntimeError) An error occurred when loading Argon2.
Make sure you have a C compiler and Erlang 20 installed.
If you are not using Erlang 20, either upgrade to Erlang 20 or
use bcrypt_elixir (version 0.12) or pbkdf2_elixir.
See the Comeonin wiki for more information.
(argon2_elixir) lib/argon2/base.ex:19: Argon2.Base.init/0
(kernel) code_server.erl:1340: anonymous fn/1 in :code_server.handle_on_load/5
** (UndefinedFunctionError) function Argon2.Base.hash_password/3 is undefined (module Argon2.Base is not available)
(argon2_elixir) Argon2.Base.hash_password("hello123", <<212, 122, 223, 217, 68, 96, 51, 247, 99, 9, 182, 11, 161, 23, 5, 82>>, [])
(comeonin) lib/comeonin/base.ex:88: Comeonin.Argon2.add_hash/2
(realtime) lib/realtime/identity/identity.ex:112: Realtime.Identity.encrypt_password/1
priv/repo/seeds.exs:113: (file)
18:24:42.925 [warn] The on_load function for module Elixir.Argon2.Base returned:
{%RuntimeError{message: "An error occurred when loading Argon2.\nMake sure you have a C compiler and Erlang 20 installed.\nIf you are not using Erlang 20, either upgrade to Erlang 20 or\nuse bcrypt_elixir (version 0.12) or pbkdf2_elixir.\nSee the Comeonin wiki for more information.\n"}, [{Argon2.Base, :init, 0, [file: 'lib/argon2/base.ex', line: 19]}, {:code_server, :"-handle_on_load/5-fun-0-", 1, [file: 'code_server.erl', line: 1340]}]}
How do I determine what version of Erlang I am using?
Looking at the elixir dockerfile I can see it says Erlang:21.
Do I need to add a C compile as a dep in my dockerfile somehow?