我试图在docker容器中打包应用程序。它依赖于authable
十六进制包。
运行时:
def get_weekdays(weekly_exception)
i, count = 1, 0
map, weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], []
while count < 7
weekdays.push(map[count]) if (weekly_exception & i) > 0
i = i << 1
count += 1
end
return weekdays
end
...我收到以下编译错误:
docker build --tag "testing:0.1" --file Dockerfile .
错误表明Authable无法读取&amp;在编译期间初始化其== 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"
配置:
我觉得我有一些简单的东西,但我无法理解它是什么。
重现问题的简单回购是https://github.com/gmile/test_authable_docker。
更新即可。清楚地表明只有在docker期间编译时才会出现错误(例如,在主机macOS上编译时一切正常)。
答案 0 :(得分:1)
此处的问题在于您的Dockerfile,尝试运行$test = array_column($test,'id');
foreach ($test as $ts){
echo $ts;
}
时config/config.exs
尚不可用。
原始Dockerfile内容:
mix deps.compile
在执行# 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