title: mtune and march when compiling in a docker image
body: <p><strong>When compiling in a docker image (i.e. in the dockerfile), what should <code>march</code> and <code>mtune</code> be set to?</strong></p>
  
  <p>Note this is not about compiling in a running container, but compiling when the container is being built (e.g. building tools from source when the image is run).</p>
  
  <p>For example, currently when I run <code>docker build</code> and install R packages from source I get loads of (could be <code>g++/gcc/f95</code> ...):</p>
  
  <pre><code>g++ -std=gnu++14 [...] -O3 -march=native -mtune=native -fPIC [...]
  </code></pre>
  
  <p>If I use <code>native</code> in an image built by Dockerhub, I guess this will use the spec of the machine used by Dockerhub, and this will impact the image binary available for download?</p>
  
  <p>This is related to <a href="https://stackoverflow.com/questions/10132904/when-compiling-programs-to-run-inside-a-vm-what-should-march-and-mtune-be-set-t">this similar question about VMs</a> but containers aren't VMs.</p>