Cache playwright install step on code changes#64
Merged
lewispb merged 1 commit intobasecamp:mainfrom Apr 17, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves Docker build caching by decoupling the Playwright install layer from application code (and most dependency) changes, so Playwright is only reinstalled when the pinned Playwright version changes.
Changes:
- Persist the pinned
Upright::PLAYWRIGHT_VERSIONinto/tmp/playwright_versionduring the build stage. - Install Playwright in the final stage based on the copied version file (instead of running Ruby/Bundler there).
- Reorder final-stage layers so Playwright install happens before copying gems/app artifacts.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
Good idea! Thanks @ttilberg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Playwright install requires loading a small part of our application to sync the version with the ruby driver.
Since this doesn't require the host app's rails code, and instead only this gem's code, we could theoretically just separate the two "copy from build" lines, reorganize the dockerfile to:
This prevents common code changes from requiring a new playwright install. However, we also need to copy the gemfile for
bundle execto work:However, there's still a situation where the Gemfile might have changes that invalidate the playwright build, and the playwright version is very rarely going to change.
Instead, this PR prints a simple version file to rely on during the build step. Docker's build cache uses the content of that file to fingerprint, so the cache now only gets busted if the Playwright version actually changes.
Closes #63