-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: improve Dockerfile caching #1053
Conversation
|
||
# Precompile elixir dependencies | ||
COPY mix.exs mix.lock .fork_version ./ | ||
COPY ./config/config.exs /consensus/config/config.exs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't know this file is read when compiling dependencies, but it makes sense
# Precompile rust crates. Rustler stores targets under _build | ||
COPY ./native /consensus/native | ||
RUN cd /consensus/native/bls_nif && cargo build --release \ | ||
--target-dir="/consensus/_build/prod/lib/lambda_ethereum_consensus/native/bls_nif" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think technically we should do mix release
at the end and then this path would change. Wonder if we have another way the doesn't involver hardcoding this path.
I've been doing a small poc of doing mix release
and then executing the binary directly instead of iex
but the problem is that it doesn't recognize the cli for a reason.
This is what chatGPT said on the matter xD.
Direct CLI Arguments with start
The ./bin/app start command for a release typically does not support passing custom CLI arguments directly to the application's code because it starts the application in the background without an attached shell. This mode is meant for production where direct terminal interaction is not common. Instead, configurations are often managed through environment variables or external configuration files, as previously mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also tried that and apparently, only env vars reach the depths of the runtime.exs
script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird..
This PR improves docker build caching by pre-compiling Rust NIFs and mix dependencies, before copying the whole repo.