nicbet/docker-phoenix

bcrypt not working

TheBlckbird opened this issue · 9 comments

I tried to scaffold the auth system, but bcrypt doesn’t work:

  • mix phx.gen.auth Accounts User users --live
  • mix deps.get
  • mix ecto.migrate:
==> bcrypt_elixir
could not compile dependency :bcrypt_elixir, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile bcrypt_elixir", update it with "mix deps.update bcrypt_elixir" or clean it with "mix deps.clean bcrypt_elixir"
==> phoenix_hoeraktion
** (Mix) "make" not found in the path. If you have set the MAKE environment variable, please make sure it is correct.

I am on macOS 14.0 and am using the latest version of Phoenix Framework.

The same happens with argon2

You have to run this command before executing mix ecto.migrate:
apk add build-base

But Bcrypt is still unavailable

I get the error Module Bcrypt not found

nicbet commented

@TheBlckbird sorry for the long wait. Work and family took a precedence over open-source the past weeks.

The Docker image does not include the build-base package that provides the make and cc commands to compile the bcrypt_elixir module.

You can run apk add build-base and then retry mix deps.compile to resolve the issue (just tested working in a brand new container / app).

I'll think for bit on whether we should include build-base in the image by default or not.

Thanks, I’ll try that out.
I think we should include build-base by default, because a lot of applications have some kind of encryption and authentication.

nicbet commented

Agreed, since the primary concern of the repo is to provide an easy out of the box dev experience, not a production runtime container, and many dependencies need to be compiled, we should have build-base baked in.

I’ll add it to the next release.

nicbet commented

build-base package is now included by default starting from 1.7.5 release.

Thank you!