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`.
This commit is contained in:
Pau Perez
2020-11-10 18:04:37 +01:00
parent bea8982085
commit 5ddfc54b2b

View File

@@ -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: