Docker container for Nextjs without standalone build #1203
Merged
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.
Motivation and context
Recently we've introduced frontend docker image with
standalone
builds, but they are not stable enough and do not provide all the needed features so the app runs smoothly.The feature that we miss the most is reading having
publicRuntimeConfig
function to read the secrets from the environment (process.env
). With standalone builds, the environment is being read only at build time and it brings hardcoded values to the runtime config. (link)With this PR we roll back the change.
The docker image size in standalone mode is 263MB which was awesome, now we're back at 950+MB bringing all the
node_module/
and.next
folders to the final production image.Another downside of
standalone
approach is that it's not yet compatible with Next 13 andapp
directory structure.We're following the progress in the main Nextjs repo around these topic