-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introducing Docker to Grape #2292
Conversation
Add entrypoint.sh Add docker-compose.yml
Let's add something to the README about using this and a CHANGELOG entry? Should there be a workflow that brings up the container in CI? |
This is nice to show people how to use Docker with grape but if it goes in the repo, feels like it belongs in something like an “examples” directory. |
Change entrypoint to accept GEMFILE
@duffn I've added examples in the CONTRIBUTING.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit below.
Can I have other maintainers say whether they would like this merged or not? Should we require/add a CI to ensure the Dockerfile works? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked locally, looks good to me)
…ker_dev # Conflicts: # CONTRIBUTING.md
rubocop offenses fixed in #2319 |
I just merged it. We can fix any failures on main. |
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.