Skip to content

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

@thedarkside

Description

@thedarkside

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions