Fix with-docker example Dockerfile
Build fails if you have a local node_modules folder which doesn't match with container runtime.
also fixes https://github.com/getsentry/sentry-cli/issues/1317
Bug
- [ ] Related issues linked using
fixes #number - [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
contributing.md
Feature
- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using
fixes #number - [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
contributing.md
Documentation / Examples
- [x] Make sure the linting passes by running
pnpm build && pnpm lint - [x] The "examples guidelines" are followed from our contributing doc
How about ignoring local node_modules folder instead? Copying files over it helps avoid runtime issues, but local node_modules still end up in one of the image layers and thus increase total image size.
Hmm it’s there already:
https://github.com/vercel/next.js/blob/b1932b081a95bf535d82faef1c4d7d7ca3de2940/examples/with-docker/.dockerignore#L3
I'm not totally convinced the builder step is even necessary. The with-docker-compose Dockerfile gets away without doing a full copy of node_modules.
If it is actually an optimization, I'd love to apply the fixed version to the other Docker examples as well.
@leerob man you are good.