我正试着把一个应用程序打包到码头容器里。它依赖于authable
十六进制包。
跑步时:
docker build --tag "testing:0.1" --file Dockerfile .
..。我得到以下编译错误:
== Compilation error on file lib/authable/repo.ex ==
** (ArgumentError) missing :adapter configuration in config :authable, Authable.Repo
lib/ecto/repo/supervisor.ex:50: Ecto.Repo.Supervisor.compile_config/2
lib/authable/repo.ex:6: (module)
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
could not compile dependency :authable, "mix compile" failed. You can recompile this dependency with "mix deps.compile authable", update it with "mix deps.update authable" or clean it with "mix deps.clean authable"
此错误指示Authable无法在编译期间读取和初始化其repo
配置:
我觉得我错过了一些简单的东西,但我不知道它是什么。
这里有一个简单的回购来重现这个问题-- docker。
更新.明确指出,只有在进行对接时才会出现错误(例如,在主机macOS上编译时一切都很好)。
发布于 2017-04-23 22:32:27
这里的问题在于您的Dockerfile,其中的config/config.exs
在尝试运行mix deps.compile
时还不可用。
原始Dockerfile内容:
# Install and compile project dependencies
COPY mix.* ./
RUN mix deps.get
RUN mix deps.compile
RUN mix ecto.create
RUN mix ecto.migrate -r Authable.Repo
# Add project sources
COPY . .
在执行mix compile
之前将其更改为复制源可以解决此问题:
....
RUN mix deps.get
# Add project sources
COPY . .
RUN mix deps.compile
...
https://stackoverflow.com/questions/43577126
复制