Closed yuuk closed 1 year ago
Hi there!
What you usually want to do with Docker is not to build your app with Docker unless you use multi-layer images. Otherwise you may end up with dev artifacts in your final docker image (node_modules, dev deps, not transpiled source code, etc).
My main advice is to build your app on your CI, then copy the Next.js build to your docker image. I will try to find a working Dockerfile if I can find an old professional project.
Having the same issue here, building in docker throws an error about not finding a local package that's installed as a dependency
+1
Have you applied what I recommended here in my message above?
What you usually want to do with Docker is not to build your app with Docker unless you use multi-layer images. Otherwise you may end up with dev artifacts in your final docker image (node_modules, dev deps, not transpiled source code, etc).
Seems like symlinks are unstable with docker. I had strange situation where it worked locally, but got same error in pipeline during deployment.
You can fix it by copying your directory to node_modules before build: COPY shared node_modules/shared RUN yarn build:app
I would definitely recommend installing your deps before then copying them, rather than installing them from your Dockerfile.
Yes, it is less "the Docker way", but you'll save yourselves the hundreds of hours I spent trying to make this work.
is there any solution to it?
I'm facing an increase in deployment time significantly after using this module, has anyone faced this issue too?
is there any solution to it?
I'm facing an increase in deployment time significantly after using this module, has anyone faced this issue too?
Where are you building your app? From your CI or from Docker? If Docker, try running the build on CI instead.
Are you trying to transpile a local package or an npm package? local package
Describe the bug I've clone the next monorepo demo https://github.com/martpie/monorepo-typescript-next-the-sane-way in my local machine(windows 10). Then I run
next build
, everything is ok!But when I do the same thing with docker, there was an error.
The dockerfile config:
The root package.json:
To Reproduce Here is a repo i've created to reproduce the problem. https://github.com/yuuk/monorepo-typescript-next-the-sane-way-with-docker
Expected behavior Transpile modules without errors
Setup
next-transpile-modules
version: 9.0.0npm
/yarn
version: 1.22.10