tino415
Copying _build, deps and recompiling in different docker container (CI/CD)
Hello all,
today I had interesting problem in our CI/CD pipeline. We set up pipeline so in one container was run mix deps.get, MIX_ENV=test mix deps.compile and MIX_ENV=test mix compile then we copied _build and deps folder to other container and run mix test there. Problem was that after running migrations tests failed on error:
** (Mix) Could not start application ranch: exited in: :ranch_app.start(:normal, []) 00:06
744 ** (EXIT) an exception was raised: 00:06
745 ** (UndefinedFunctionError) function :ranch_app.start/2 is undefined (module :ranch_app is not available) 00:06
746 (ranch 1.8.0) :ranch_app.start(:normal, []) 00:06
747 (kernel 8.3.2.3) application_master.erl:293: :application_master.start_it_old/4
Which got resolved by running MIX_ENV=test mix deps.compile on testing machine. My question is why is that? Is that somehow avoidable? On localhost I never had to run MIX_ENV=test mix deps.compile or MIX_ENV=test mix compile to be able to run mix test and deps.compile takes a lot of time and noticeably slowing down our pipeline.
Most Liked
BradS2S
It isn’t best practices to copy the _buikd folder and move it. I’m not sure I follow you completely.
Last Post!
felix-starman
I just ran into this with GitHub Actions and caching.
I believe it’s that _build/test/lib/ranch/ebin/ is a symlink to deps/ranch/ebin/ and during deps.compile it will actually compile the .beam files into the deps/ranch/ebin folder. If there is a discrepancy between architectures, erlang versions, or anything that would cause the .beam file in the deps/ranch/ebin file to be considered invalid for the final runtime container, it will fail to find it. Or I guess if you’re only moving the _build and not the deps too, that’d do it. In that case, if you’re only moving the _build, then you probably want a release. If this isn’t for a release container, then you’ll need to copy deps and _build
Obviously my scenario is very different, but I hope that helps some?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









