Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save markjlorenz/9281a1eb303399b9847233735935ddf5 to your computer and use it in GitHub Desktop.
Save markjlorenz/9281a1eb303399b9847233735935ddf5 to your computer and use it in GitHub Desktop.

Run the container, with the gem files living on the host filesystem

docker run -it --rm \
  --volume "$PWD":/app \
  --workdir /app \
  --env "BUNDLE_PATH=.gems" \
  --link "earnings-calls-database"  \
  soodesune/ruby-rails:2.3.1-alpine sh

Run the tests once, and then copy the gems into the container and run the tests again.

/app # bundle exec rspec
...........

Finished in 6.95 seconds (files took 1 minute 27.65 seconds to load)
11 examples, 0 failure

It took 1m 27sec to lost the files! Copy them into the container and run the test again.

/app # cp -r .gems /.gems2
/app # BUNDLE_PATH=/.gems2
/app # bundle exec rspec
...........

Finished in 0.67496 seconds (files took 3.76 seconds to load)
11 examples, 0 failure

Only ~4 seconds to load the files! The slowdow is definitly cased by pulling the gems across the host filesystem mount.

@markjlorenz
Copy link
Author

markjlorenz commented Aug 2, 2016

Since this is a "temporary" problem, I elected to:

  1. Start the container with --env GEM_PATH=/.fast-gems
  2. docker exec -it THE_CONTAINER_NAME cp -r .gems /.fast-gems

I'm not bundling that much right now, so I can just repeat (2) each time. Soon this will be fixed by the docker team anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment