Fixed dockerfile to stop having redundant minification#184
Fixed dockerfile to stop having redundant minification#184sfreeman422 merged 2 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the backend container build to remove an extra esbuild bundling/minification step, aiming to avoid redundant minification in the Docker image build.
Changes:
- Removes the explicit
npx esbuild ... --bundle --minify ... --outfile runtime.cjsstep from the build stage. - Switches the release stage to copy
dist/index.jsdirectly asruntime.cjs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # Copy bundled runtime artifact and writable path from build stage. | ||
| COPY --from=build --chown=65532:65532 /usr/src/app/packages/backend/dist/runtime.cjs ./runtime.cjs | ||
| COPY --from=build --chown=65532:65532 /usr/src/app/packages/backend/dist/index.js ./runtime.cjs |
There was a problem hiding this comment.
The release stage no longer includes a fully bundled artifact. npm run minify for @mocker/backend uses --packages=external, so dist/index.js will still require() runtime deps (express/typeorm/etc). Since the distroless stage doesn’t copy node_modules, the container will fail at runtime with missing module errors. Consider restoring the dedicated esbuild bundling step (you can drop --minify there to avoid double-minification), or alternatively copy/prune node_modules into the release image (or use a runtime base image that can install prod deps).
No description provided.