Advertisement
Guest User

Untitled

a guest
Aug 8th, 2017
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. #### Dockerfile ####
  2.  
  3. # Use the barebones version of Ruby 2.2.3.
  4. FROM ruby:2.2.3-slim
  5.  
  6. # Optionally set a maintainer name to let people know who made this image.
  7. MAINTAINER Nick Janetakis <nick.janetakis@gmail.com>
  8.  
  9. # Install dependencies:
  10. # - build-essential: To ensure certain gems can be compiled
  11. # - nodejs: Compile assets
  12. # - libpq-dev: Communicate with postgres through the postgres gem
  13. # - postgresql-client-9.4: In case you want to talk directly to postgres
  14. #RUN apt-get update && apt-get install -qq -y build-essential nodejs libpq-dev postgresql-client-9.4 --fix-missing --no-install-recommends
  15. # modifying ^ for OSX
  16. # you must have Xcode and Xcode command line tools installed
  17. # before running this
  18. CMD brew update && brew install node postgresql
  19.  
  20. # Set an environment variable to store where the app is installed to inside
  21. # of the Docker image.
  22. ENV INSTALL_PATH /drkiq
  23. RUN mkdir -p $INSTALL_PATH
  24.  
  25. # This sets the context of where commands will be ran in and is documented
  26. # on Docker's website extensively.
  27. WORKDIR $INSTALL_PATH
  28.  
  29. # Ensure gems are cached and only get updated when they change. This will
  30. # drastically increase build times when your gems do not change.
  31. COPY Gemfile Gemfile
  32. RUN bundle install
  33.  
  34. # Copy in the application code from your work station at the current directory
  35. # over to the working directory.
  36. COPY . .
  37.  
  38. # Provide dummy data to Rails so it can pre-compile assets.
  39. RUN bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:pass@127.0.0.1/dbname SECRET_TOKEN=pickasecuretoken assets:precompile
  40.  
  41. # Expose a volume so that nginx will be able to read in assets in production.
  42. VOLUME ["$INSTALL_PATH/public"]
  43.  
  44. # The default command that gets ran will be to start the Unicorn server.
  45. CMD bundle exec unicorn -c config/unicorn.rb
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. #### docker-compose.yml ####
  53.  
  54. # taken directly from
  55. # https://semaphoreci.com/community/tutorials/dockerizing-a-ruby-on-rails-application
  56.  
  57. postgres:
  58. image: postgres:9.4.5
  59. environment:
  60. POSTGRES_USER: drkiq
  61. POSTGRES_PASSWORD:
  62. ports:
  63. - '5432:5432'
  64. volumes:
  65. - drkiq-postgres:/var/lib/postgresql/data
  66.  
  67. redis:
  68. image: redis:3.0.5
  69. ports:
  70. - '6379:6379'
  71. volumes:
  72. - drkiq-redis:/var/lib/redis/data
  73.  
  74. drkiq:
  75. build: .
  76. links:
  77. - postgres
  78. - redis
  79. volumes:
  80. - .:/drkiq
  81. ports:
  82. - '8000:8000'
  83. env_file:
  84. - .drkiq.env
  85.  
  86. sidekiq:
  87. build: .
  88. command: bundle exec sidekiq -C config/sidekiq.yml
  89. links:
  90. - postgres
  91. - redis
  92. volumes:
  93. - .:/drkiq
  94. env_file:
  95. - .drkiq.env
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement