Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error to use jchash as dependency in Elixir Docker slim image #1

Closed
vsouza opened this issue Sep 11, 2019 · 3 comments
Closed

Error to use jchash as dependency in Elixir Docker slim image #1

vsouza opened this issue Sep 11, 2019 · 3 comments

Comments

@vsouza
Copy link

vsouza commented Sep 11, 2019

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?

@cabol
Copy link
Owner

cabol commented Sep 11, 2019

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

@cabol
Copy link
Owner

cabol commented Sep 12, 2019

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

@vsouza
Copy link
Author

vsouza commented Oct 21, 2019

@cabol Sorry for delay. Thank you!

@cabol cabol closed this as completed Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants