Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This change modifies the Next.js configuration and Dockerfile to use the standalone output mode, which drastically reduces the final Docker image size by including only necessary production files.

This commit optimizes the Docker image size by leveraging Next.js's standalone output feature.

Key changes:
- Enabled `output: 'standalone'` in `frontend/next.config.mjs`.
- Modified the `Dockerfile` to build a smaller production image:
  - Copies only the necessary artifacts from the frontend build (`.next/standalone`, `.next/static`, `public`).
  - Removes the need to copy the entire `node_modules` directory.
  - Updates the startup script to use `node server.js` to run the frontend server.

This significantly reduces the final image size, addressing the user's request for a smaller Docker image.
@jeremy-feng jeremy-feng marked this pull request as ready for review August 15, 2025 07:35
@jeremy-feng jeremy-feng merged commit 4ce121a into main Aug 15, 2025
1 check passed
@jeremy-feng jeremy-feng deleted the feat/optimize-docker-standalone branch August 15, 2025 08:24
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