Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. generate(:scaffold, "post", "title:string", "body:text")
  2.  
  3. route "root to: 'posts#index'"
  4.  
  5. file 'config/database.yml', <<-CODE
  6. default: &default
  7. adapter: postgresql
  8. encoding: unicode
  9. pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  10. host: db
  11. username: <%= ENV.fetch('POSTGRES_USER') %>
  12. password: <%= ENV.fetch('POSTGRES_PASSWORD') %>
  13.  
  14. development:
  15. <<: *default
  16. database: my-app_development
  17.  
  18. test:
  19. <<: *default
  20. database: my-app_test
  21.  
  22. production:
  23. <<: *default
  24. database: my-app_production
  25. CODE
  26.  
  27. file 'Dockerfile', <<-CODE
  28. FROM ruby:2.3-alpine
  29.  
  30. # Set local timezone
  31. RUN apk add --update tzdata && \
  32. cp /usr/share/zoneinfo/Europe/London /etc/localtime && \
  33. echo "Europe/London" > /etc/timezone
  34.  
  35. # Install your app's runtime dependencies in the container
  36. RUN apk add --update --virtual runtime-deps postgresql-client nodejs libffi-dev readline sqlite
  37.  
  38. # Bundle into the temp directory
  39. WORKDIR /tmp
  40. ADD Gemfile* ./
  41.  
  42. RUN apk add --virtual build-deps build-base openssl-dev postgresql-dev libc-dev linux-headers libxml2-dev libxslt-dev readline-dev && \
  43. bundle install --jobs=2 && \
  44. apk del build-deps
  45.  
  46. # Copy the app's code into the container
  47. ENV APP_HOME /app
  48. COPY . $APP_HOME
  49. WORKDIR $APP_HOME
  50.  
  51. # Configure production environment variables
  52. ENV RAILS_ENV=production \
  53. RACK_ENV=production
  54.  
  55. # Expose port 3000 from the container
  56. EXPOSE 3000
  57.  
  58. # Run puma server by default
  59. CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
  60. CODE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement