title: How to set environment variables within Dockerfile's RUN?
body: <p>I need to set the output of a <code>RUN</code> command to be an environment variable that is available inside my container after it's built:</p>
  
  <pre><code>...
  
  RUN ...
      GO111MODULE=on go get github.com/emersion/hydroxide/cmd/hydroxide &amp;&amp; \
      echo "the_password" | hydroxide auth the_username@protonmail.com &gt; bridge_password.txt &amp;&amp; \
      BRIDGE_PASSWORD=`sed -n 's/Password: Bridge password: //p' bridge_password.txt` &amp;&amp; \
      hydroxide smtp
  
  ...
  
  </code></pre>
  
  <p>Above, I need <code>$BRIDGE_PASSWORD</code> to be available in my NodeJS project (<code>process.env.BRIDGE_PASSWORD</code>). How can I achieve this? </p>