Use mix.lock file without mix.exs file

Hello,

I am trying to figure out how to download and compile my application’s dependencies, listed in a mix.lock file, without having a mix.exs file. Sort of like a requirements.txt in python.

Reason:

I am building and packaging my Elixir application using Docker.

I have an umbrella app with 5 different mix.exs files. They tend to churn a lot, which busts my mix deps.get and dialyzer caches, which makes my builds go from 5 minutes to an hour.

If I could use my mix.lock file, which we can assume is up to date and contains all of my required dependencies, without having to import all of these different mix.exs files, it would be grand. I would be able to utilize the Docker cache in a much more efficient way.

Thanks a bunch!

They’re churning alot without causing a lot of churn in mix.lock ?

Why are you running dialyzer in a docker build?

It’s an easy way to cache our dialyzer.plt files without having to instrument copying the PLT into the file system and uploading it into an s3 bucket, tagged by the hash of the mix.lock file.

Why do you need them on s3?

In order to cache my PLT files in order to make my builds go faster.

PLTs are not essential for your build.

If it’s part of his CI then it will be. I feel like we’re getting a bit off from the original point. Caching mix or PLT or whatever can be perfectly fine. Separating mix.exs from mix.lock isn’t gonna work, so I think it would be most productive to figure out what about caching the mix.exs is an issue.

1 Like

Yeah, if it’s for CI I totally understand the need to cache the PLTs, but not why they need to be in the docker… Most CIaaS I’m aware of provide proper caching, just tell them to cache the PLTs and one is fine.

But you are righr, we are drifting away and I also think, that using mixlock without an actual mixfile isn’t possible. There isn’t even all information from the mixexs in the mixlock available.

If your mix file changes frequently the lock file will probably as well. If your lock file changes some PLTs needs to be rebuild. That’s just the way it works.