Skip to content
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

Precompile creates log files which land in the final image #372

Open
thedarkside opened this issue Dec 3, 2023 · 1 comment
Open

Precompile creates log files which land in the final image #372

thedarkside opened this issue Dec 3, 2023 · 1 comment

Comments

@thedarkside
Copy link

thedarkside commented Dec 3, 2023

After upgrading to jammy builder and to rails 7.0 (including sprockets-rails upgrade) i am observing a difference in the built image contents. The /log directory now contains empty log files!
I believe it is due to sprockets-rails loading now the complete environment during assets:precompile resulting in those log files being created.

And because the jammy builder runs the build env with a different user id then the run env, the permissions don't allow writing those files which leads to a crash on startup.

"log to stdout" doesnt help me here either, because my stack outputs multiple log streams. I simply can not mix them in just one STDOUT stream. So i need those files writable during runtime!

Describe the Enhancement

After thinking about different solutions i came to the conclusion that the most elegant one would be to execute a "cleanup" task after compilation in this buildpack.
I mean, if we assume that after executing precompilation some logs getting written, it makes sense to solve this by cleaning up this directory leaving a clean image.

Possible Solution

Just a simple rm -rf /workspace/log/* after precompile would solve it. Or it could be rollback'ed to the previous state by taking a snapshot before the precompilation and copying over the snapshot after the precompilation.

@sophiewigmore
Copy link
Member

sophiewigmore commented Dec 5, 2023

@thedarkside sorry you're having issues upgrading to Jammy. I think your idea of doing a log cleanup makes sense - unless for some reason a user might want to look at those logs at runtime? Or they might want to look at logs in the case of a failed build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants