DEV Community

Discussion on: Running dev.to in a container

 
chuck_ha profile image
Chuck Ha

To your point I think there is a better solution than what I've provided in this article. I should be using a multistage build. If I were building dev.to on a container for production I'd probably have a build pipeline for each commit that would do something like:

  1. build a ruby image based off .ruby-version file
  2. build a dependency image from the ruby image off the gemfile/yarnfile
  3. build an image with compiled assets
  4. add in the app code

The only time all the build steps get run is when the ruby-version is updated, otherwise the build uses the cache (assuming docker is able to cache i.e. the build is not running in ephemeral infrastructure). In the normal case where the app code is changing but the dependencies are not only the last step is executed which should be relatively quick.