The (very good) guide to Mastodon deployment at https://github.com/mitchellurgero/fediwiki/blob/master/mastodon_install.md#BuildMastodon includes the steps:

> 7. docker-compose run --rm web rails assets:precompile
> Precompile the asset cache for SPEED.
> 8. docker-compose build
> Needed again after the precompile command always.

I'm confused about the rebuild after precompile. If you run the compile inside the container why is a rebuild needed?

@rustyk5 My guess is the precompile puts the precompiled data in some directory mounted as a volume to the web container used for precompile. But then a rebuild is necessary to put that data into the Docker image itself, where it expects to find it (rather than in a volume, for whatever reason).
@guan oh huh. Maybe! This is a weird roundabout design, if so.
@rustyk5 It sort of fits with Docker convention/style. Data like that “should” be in the image, but they also wanted to use a container to perform the prebuild. So you need some acrobatics to achieve that.
@guan it would make more sense to run the prebuild on startup, or inside the web container once it's running, or something less circular imo
@guan ok I think I figured it out -- the precompile writes js and css bundles to public/assets/, which is mounted as a volume in the container. But rails won't pick up the new bundles without a restart, so you need to *restart* the web container, but you don't need to rebuild it.