From 5ddfc54b2bae51cccbb122d4f8c8e70ae8f28359 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Tue, 10 Nov 2020 18:04:37 +0100 Subject: [PATCH] Install any missing gems when booting docker This runs `bundle install` if there are any missing gems when booting the containers. `bundle check` ensures we don't unnecessarily run `bundle install`, which is rather slow. This avoids having to build the entire image (painfully slow) or having to bring up a container just to install the gems. I used to do this with `docker-compose run --rm web bundle install`. --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 9763cc1043..8ac4a7100a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,6 +30,7 @@ services: command: > bash -c "wait-for-it -t 30 db:5432 && rm -f tmp/pids/server.pid && + (bundle check || bundle install) yarn install && bundle exec rails s -p 3000 -b '0.0.0.0'" worker: @@ -47,6 +48,7 @@ services: OFN_DB_HOST: db command: > bash -c "wait-for-it -t 30 db:5432 && + (bundle check || bundle install) bundle exec rake jobs:work" volumes: gems: