Browse Source

Setting Docker for development (#569)

Setting Docker for development
Dave Newton 6 years ago
parent
commit
2e069578fc
3 changed files with 29 additions and 0 deletions
  1. 11 0
      README.md
  2. 5 0
      Rakefile
  3. 13 0
      docker-compose.yml

+ 11 - 0
README.md

@@ -374,6 +374,17 @@ bundle install
 bundle exec rake test
 ```
 
+or if you'd rather use docker just run:
+```bash
+docker run -it --name shopify_api -v "$PWD:/shopify_api" -w="/shopify_api" ruby:2.6 bundle install
+docker exec -it shopify_api bash
+```
+
+or you can even use our automated rake task for docker:
+```bash
+bundle exec rake docker
+```
+
 ## Additional Resources
 
 * [API Reference](https://help.shopify.com/api/reference)

+ 5 - 0
Rakefile

@@ -37,3 +37,8 @@ Rake::RDocTask.new do |rdoc|
   rdoc.rdoc_files.include('README*')
   rdoc.rdoc_files.include('lib/**/*.rb')
 end
+
+task :docker do
+  cmd = "docker-compose up -d && docker exec -i -t shopify_api bash"
+  exec(cmd, err: File::NULL)
+end

+ 13 - 0
docker-compose.yml

@@ -0,0 +1,13 @@
+version: '3.5'
+services:
+  api:
+    container_name: shopify_api
+    image: ruby:2.6
+    working_dir: /shopify_api
+    volumes:
+      - .:/shopify_api
+      - bundle:/usr/local/bundle
+    command: bash -c "bundle install && tail -f /dev/null"
+
+volumes:
+  bundle: