softprops / lambda-rust

🐳 🦀 a dockerized lambda build env for rust applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running from subdirectory

Luminoth opened this issue · comments

commented

I have a lambda project that uses a local path dependency that looks like this in the Cargo.toml:

[dependencies.logger]
path = "../../libs/logger"

That's posing a problem for using the builder since it assumes everything lives top-level in /code. Is there any way to pass in that entry point rather than assuming it's always going to be /code ? Or maybe some way to work around the local dependency problem?

commented

If I'm understanding how the setup works, it should just be a matter of adding an ENV for the WORKDIR in the Dockerfile?

Do you use cargo workspaces? If so, workspaces are supported. These let you share dependencies between crates in a single project.

Can you elaborate a bit more on your project structure if it's not setup as a cargo workspace?

commented

Unfortunately, we don't use Cargo workspaces, as much as I wish we did. We have essentially some disjoint Rust libs and a couple Rust apps inside of a much much larger C++ mono repo structure. Using the local dependencies has so far been the easiest way of massaging all of it together without upending the C++ centric build system.

commented

Actually, doing some Docker learning today and it looks like I can probably accomplish this using -w to override the WORKDIR.

Good to hear. If you have time, I'd be happy take a pull to update the readme with similar example in case others hit the same issue.