Docker for Rails Developers(p60): webpacker install fails in docker-compose if volume used

It seems to me that the default Rails 6 install with webpacker presents a problem.

Within my Dockerfile, I have the line:

COPY . /usr/src/app/
RUN bundle exec rake webpacker:install

Which builds fine by itself, but it fails when adding the volume to docker-compose.yml

volumes:
- .:/usr/src/app

It seems to be because the config/webpacker.yml gets overwritten when docker-compose performs the mount.

2 Likes