Optimally dockerizing NextJS application — “Runtime” environment variable configuration( Part 2 )

<h1>Before we begin</h1> <p>This article serves as a continuation of the previously mentioned piece on the optimal dockerization of a NextJS application, which can be found here:</p> <p><a href="https://medium.com/geekculture/optimally-dockerizing-nextjs-application-and-lessons-learned-af1833e7da46" rel="noopener">https://medium.com/geekculture/optimally-dockerizing-nextjs-application-and-lessons-learned-af1833e7da46</a></p> <p>If you haven&rsquo;t had the chance to explore the earlier article, I highly recommend doing so. It will provide valuable insights into the implementation process and the underlying reasons for this endeavor.</p> <h1>Introduction</h1> <p>When working with NextJS, managing runtime variables can be a bit of a challenge. While the documentation provides some insight into how these variables are handled, it doesn&rsquo;t explicitly explain their treatment when packaging a NextJS app in standalone mode.</p> <p>Let&rsquo;s take a moment to review how NextJS handles environment variables differently. Variables prefixed with&nbsp;<code>NEXT_PUBLIC_*</code>&nbsp;are included in the client-side bundle. These variables are embedded at build time, making them accessible in browser bundles.</p> <p><a href="https://prabeshthapa.medium.com/optimally-dockerizing-nextjs-application-runtime-configuration-and-environment-variables-part-19ae133cfcf1"><strong>Read More</strong></a></p>