Skip to content

Fixed dockerfile to stop having redundant minification#184

Merged
sfreeman422 merged 2 commits intomasterfrom
fix/dockerfile
Mar 22, 2026
Merged

Fixed dockerfile to stop having redundant minification#184
sfreeman422 merged 2 commits intomasterfrom
fix/dockerfile

Conversation

@sfreeman422
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 22, 2026 12:57
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.cjs step from the build stage.
  • Switches the release stage to copy dist/index.js directly as runtime.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
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
@sfreeman422 sfreeman422 merged commit 1d949ca into master Mar 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants