feat: copy public directory to production image #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
This PR adds the
publicdirectory copy to the final production stage of the Dockerfile. Next.js applications often have static assets in thepublicfolder, and these need to be available in the production container.What was changed
COPY --from=builder /app/public ./publicto the runner stage in the Dockerfile to ensure the public directory is included in the production image if it exists.Additional suggestions
I'd also like to suggest considering adding the following for this Dockerfile:
Other package manager support: Currently, the Dockerfile is hardcoded to use
pnpm. It would be beneficial to make it more flexible to supportnpm,pnpm,yarn, andbun, similar to the approach used in the official Next.js Docker example: https://github.com/vercel/next.js/blob/canary/examples/with-docker/DockerfileBun support: With the growing adoption of Bun as a faster JavaScript runtime and package manager, it would be great to update this Dockerfile to optionally support Bun.
I had some struggle even with the docker-example for bun while facing into some error with regards to SSR chunks not being found!
Since this repository is still used in the official examples for the documentation of using with SST, I thought I'd help with this