Using Rails 5, Docker and docker-compose to build an authenticated JSON API with warden
I migrated my last tutorial from last year for an authenticated JSON API with Ruby on Rails 5 to using Docker and docker-compose
You can find the complete application on my github profile. It’s basically the same code described in my tutorial from last year but starting from a newly created Rails 5 application with the
--api flag coming from the integration of the previously separated
rails-api gem, now part of Rails.
I used the methods to bootstrap the application described in my rails-docker project. With this setup you don’t even need to have a ruby environment running on your local development machine, given you can run Docker.
I run the test and other scripts/rake commands with a simple
docker-compose run web bin/rspec or I can even enter the docker container and run the command inside by using
docker-compose run web bash.
If you are curious about this setup, please send me an email to email@example.com or comment in the comments section below.
Have fun!^Back to top