title: Why does Heroku rebuild my Docker container every time?
body: <p>I'm deploying a Rust app with Rocket.rs in a Docker container to Heroku.  Each time I make one small change, I have to push the entire container.  This required re-downloading all the rust components (rustc, rust-std, cargo, etc.), redownloading all dependencies, and re-pushing layers.  In particular, there is one 1.02 GB layer that is pushed <em>every</em> time, which takes about 30 minutes.  Every time.  How can I avoid:</p>
  
  <ul>
  <li>Re-downloading rustc, rust-std, cargo, and rust-docs every time</li>
  <li>Re-downloading the same, unchanged dependencies, every time</li>
  <li>Re-pushing a 1.02 GB layer every time</li>
  </ul>
  
  <p>Here is a Gist with all my relevant files: <a href="https://gist.github.com/vcapra1/0a857aac8f05277e65ea5d86e8e4e239" rel="noreferrer">https://gist.github.com/vcapra1/0a857aac8f05277e65ea5d86e8e4e239</a></p>
  
  <p>By the way I should mention my code is pretty minimal: (this is the only .rs file)</p>
  
  <pre><code>#![feature(proc_macro_hygiene, decl_macro)]
  #[macro_use] extern crate rocket;
  
  use std::fs;
  
  #[get("/")]
  fn index() -&gt; &amp;'static str {
      "Hello from Rust!"
  }
  
  fn main() {
      rocket::ignite().mount("/", routes![index]).launch();
  }
  </code></pre>