Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I've been using Docker for a while now and I thought it would be a great addition to include a Dockerfile to Grape. Also,
docker-compose
always been my go to for running containers even though its for multiple containers. It's just easier to configure than runningdocker
commands with arguments.Dockerfile
ARG
calledRUBY_VERSION
for building an image on different ruby-versionBUNDLE_PATH
to/usr/local/bundle/gems
LIB_PATH
to/var/grape
. Code from the host will be copied in that folderrubygems
andbundle
Entrypoint
bundle exec :your_command
Docker-compose
RUBY_VERSION
to3
.gems
volumeBasic CLI
docker-compose run --rm --build grape <your_command>
. You may replace<your_command>
by anything that runs underbundle exec
--rm
will remove automatically the container--build
will automatically build or rebuild the image (useful when changing RUBY_VERSION)CLI
docker-compose run --rm --build grape rspec
docker-compose run --rm --build grape rspec spec/:file_path
docker-compose run --rm --build grape rake <task_name>
docker-compose run --rm --build grape rubocop
RUBY_VERSION=2.7.7 docker-compose run --rm --build grape rspec
docker-compose run -e GEMFILE=rails_7 --rm --build grape rspec
Running the container will automatically install the missings gems and run your command.