Skip to content

Commit

Permalink
Add BOOTSNAP_READONLY to Dockerfile template for production
Browse files Browse the repository at this point in the history
This was added in back in bootsnap 1.15.0 (Shopify/bootsnap#428).
This can save extra work and IO when the cache won't be changed, like is the case for docker containers
  • Loading branch information
technicalpickles committed Nov 16, 2023
1 parent 67bc765 commit 397719f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions railties/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* Change generated Dockerfile to use bootsnap read-only mode. This saves
some work of bootsnap trying to update its cache when it won't be re-used.

*Josh Nichols*

* Fix running `db:system:change` when app has no Dockerfile.

*Hartley McGuire*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
# Final stage for app image
FROM base

# Switch to read-only since any cache changes after this point won't persist between containers
ENV BOOTSNAP_READONLY="1"

<% unless dockerfile_deploy_packages.empty? -%>
# Install packages needed for deployment
RUN apt-get update -qq && \
Expand Down

0 comments on commit 397719f

Please sign in to comment.