Skip to content

Cleanup cache after bundle install #645

@palexvs

Description

@palexvs

Hi, I noticed that the cache size is double what all gems in my project weigh. It seems like it's due to ${BUNDLE_PATH}/ruby/*/cache/*.gem files. But I don't think we need them after bundle install is finished. Or am I missing something?

I was thinking about adding a config param like prune-bundle-cache: true that would run rm -rf ${BUNDLE_PATH}/ruby/*/cache after bundle install

Rails already does it https://github.com/rails/rails/blob/9e9f80778abb38b8d884d456594d6b6fa683c773/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt#L57

RUN bundle install && \
    rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions