title: React & Webpack & Docker: Inject env's at runtime in production to the docker-container
body: <p>Hi try to deploy my React-App with Docker and Webpack. My problem is that I want to inject my Environment Variables at runtime.</p>
  <p>If I run my docker I want that the env ENV_TEST has the value testValue</p>
  <pre><code>docker run -p 8080:8080 -e ENV_TEST=testValue client
  </code></pre>
  <p>Webpack-file:</p>
  <pre><code>new webpack.DefinePlugin({
      &quot;process.env.ENV_TEST&quot;: JSON.stringify(
          process.env.ENV_TEST
      ),
  }),
  </code></pre>
  <p>Docker-file:</p>
  <pre><code>ENV ENV_TEST=default
  </code></pre>
  <p>React:</p>
  <pre><code>console.log(process.env.ENV_TEST)
  //--&gt;default
  </code></pre>
  <p>At the moment my ENV_TEST has the value default (form the Docker-file form the build-time).
  If I don't define the value in my Docker-File the ENV_TEST is undefined. If I run my docker container with <code>-e ENV_TEST=testValue</code> I want to overwrite the default value with the value testValue.</p>
  <p>Thx for any help</p>