🐳 fix(docker): add optional dependency for rollup library - linux binary #3
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.
Resolves rollup native module missing error on Apple Silicon by adding
@rollup/rollup-linux-arm64-musl as optional dependency.
Before
docker-compose --profile app build
on Apple Silicon caused:The issue
The Mac (Host): macOS ARM64 (Darwin ARM64)
Docker Container: Linux ARM64 (linux-arm64-musl)
When you run npm install on your Mac, npm installs the rollup binary for macOS ARM64:
@rollup/rollup-darwin-arm64 ✅ (gets installed)
But inside the Docker container, you're running Linux ARM64, which needs a different binary:
@rollup/rollup-linux-arm64-musl ❌ (missing!)
The solution
By adding the optional dependency, we ensure that both binaries are available:
Darwin ARM64 binary (for Mac)
Linux ARM64 binary (for Docker container)
This way, rollup can find the correct binary regardless of whether it's running on your Mac directly or inside a Linux Docker container on your Mac.
The architecture matches (ARM64), but the operating system (Darwin vs Linux) requires different compiled binaries.