cabol / jchash

Jump Consistent Hash NIF library for Erlang/Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error to use jchash as dependency in Elixir Docker slim image

vsouza opened this issue · comments

Hi, @cabol hope you're going well.

I'm using Nebulex with Redis Cluster as backend. I have as a requirement a small docker image size to deploy my application. But, when I use Elixir Docker Slim Image or Elixir Docker Alpine Image I receive an error when Mix tries to compile jchash:

** (Mix) Could not compile dependency :jchash, "/root/.mix/rebar3 bare compile --paths "/upa/_build/prod/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile jchash", update it with "mix deps.update jchash" or clean it with "mix deps.clean jchash"

Versions:

{:jchash, "0.1.1"}
Elixir: 1.8.2
Erlang: 22
{:nebulex, "~> 1.1"},
{:nebulex_redis_adapter, "~> 1.1"}

Can you help me to find which OS dependency I must to install to solve this?

Sure, let me try to reproduce the error and see how we can fix it!

After running several tests, in order to make it work, I had to provide my own Dockerfile:

FROM elixir:1.9-alpine

RUN apk update && \
  apk upgrade --no-cache && \
  apk add --no-cache \
    git \
    build-base && \
  mix local.rebar --force && \
  mix local.hex --force

CMD ["iex"]

I think you have to run/force (the trick is in these two commands):

mix local.rebar --force && \
mix local.hex --force

After that, it did work. To test it out I ran:

$ docker build -t myalpine .
$ docker run --rm -v $PWD:/myapp -w /app -it myalpine mix deps.compile
$ docker run --rm -v $PWD:/myapp -w /app -it myalpine mix compile

@cabol Sorry for delay. Thank you!