-
Notifications
You must be signed in to change notification settings - Fork 5
add ZERO_SKIP_SQLITE3_BUILD env to skip native builds #7
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
Open
Karavil
wants to merge
33
commits into
rocicorp:main
Choose a base branch
from
Karavil:add-zero-skip-build-env
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
checkout the bedrock branch
build the sqlite shell as well
since the binary `zero_sqlite3` does not exist during `npm install`, it never gets linked into `node_modules/.bin`. We need a wrapper script that exists from the start and points to the binary.
This change is made blind with help of chatgpt. I'm not sure how to test or deploy.
feat: Allow flags and args to be passed through to sqlite3.
chore: bump version to 1.1.0.
…rsion Fix node 24 compatibility (by using node-abi 4.11.0)
… builds This adds support for skipping the native module build process via the ZERO_SKIP_SQLITE3_BUILD environment variable. This is particularly useful in Docker multi-stage builds and monorepo setups where the build step can add significant time to deployments. Key changes: - Created install.js script that checks for ZERO_SKIP_SQLITE3_BUILD - Updated package.json to use the new install script - Added documentation to README.md This change is backward compatible - without the environment variable, the package behaves exactly as before.
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.
Overview
Adds an environment variable to skip the native module build during installation. This is killing us in Docker builds for our monorepo where the postinstall script adds ~2 minutes to every build even when the binaries are already cached.
The issue is that
@rocicorp/zero-sqlite3is intrustedDependenciesin ourbun.lock(transitive from@rocicorp/zerowhich is a devDependency). Even though we don't need it in production, Bun auto-installs it because it's marked as trusted. We can't dynamically remove it fromtrustedDependenciesbecause Bun's lock file has integrity checks.Right now we're surgically modifying the lock file with
sedwhich works but feels hacky.With this change we can just set
ZERO_SKIP_SQLITE3_BUILD=truein our Dockerfile and skip the unnecessary rebuild.Implementation
install.jsthat checks for the env varZERO_SKIP_SQLITE3_BUILD=true, logs a message and exitsprebuild-install || node-gyp rebuildflowOur Monorepo Context
In our monorepo:
@rocicorp/zerois a devDependency inpackages/zero/package.json@rocicorp/zero-sqlite3is intrustedDependencies(transitive dependency)--productionflagCurrent workaround in our Dockerfile:
With this PR:
Testing
Tested on macOS (M1 Mac) with the following results:
Normal Install (no env variable)
With Skip Environment Variable
Performance Impact
On a Mac M1:
In our Docker builds (Linux ARM64 on AWS):
Things to Test
ZERO_SKIP_SQLITE3_BUILD=true