Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. 1 app:
  2. 2 build: .
  3. 3
  4. 4 env_file: .env.production
  5. 5
  6. 6 environment:
  7. 7 RAILS_ENV: $RAILS_ENV
  8. 8
  9. 9 links:
  10. 10 - db
  11. 11
  12.  
  13. 14 expose:
  14. 15 - "3000"
  15. 16
  16. 17 db:
  17. 18 image: postgres:9.4.5
  18. 19
  19. 20 volumes:
  20. 21 - eshop-postgres:/var/lib/postgresql/data
  21. 22
  22. 23 web:
  23. 24 build: .
  24. 25
  25. 26 dockerfile: config/containers/Dockerfile-nginx
  26. 27
  27. 28 volumes:
  28. 29 - ./public:/var/www/eshop/public
  29. 30
  30. 31 links:
  31. 32 - app
  32. 33 ports:
  33. 34 - "80:80"
  34.  
  35. 2 FROM ruby:2.3.3-slim
  36. 12 RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client libsqlite3-dev nodejs vim
  37. 15 ENV RAILS_ROOT /var/www/myapp
  38. 18 RUN mkdir -p $RAILS_ROOT/tmp/pids
  39. 19
  40. 21 WORKDIR $RAILS_ROOT
  41. 22
  42. 26 COPY Gemfile Gemfile
  43. 27
  44. 28 COPY Gemfile.lock Gemfile.lock
  45. 29
  46. 31 RUN gem install bundler
  47. 32
  48. 34 RUN bundle install
  49. 35
  50. 37 COPY . .
  51. 38
  52.  
  53. 39 - RUN RAILS_ENV=production bundle exec rake assets:precompile --trace~
  54. 40 - RUN bundle exec rake assets:precompile --trace~
  55.  
  56. 40 + RUN bundle exec rake RAILS_ENV=$RAILS_ENV DATABASE_URL=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@127.0.0.1/$POSTGRES_PRODUCTION_DB assets:precompile
  57. 41 + VOLUMES ["$RAILS_ROOT/public"]
  58.  
  59. 46 + CMD [ "config/containers/app_cmd.sh" ]
  60.  
  61. 2 FROM nginx
  62.  
  63. 12 RUN apt-get update -qq && apt-get -y install apache2-utils vim
  64.  
  65. 15 ENV RAILS_ROOT /var/www/myapp
  66.  
  67. 18 WORKDIR $RAILS_ROOT
  68.  
  69. 21 RUN mkdir log
  70.  
  71. 25 COPY public public/
  72.  
  73. 28 COPY config/containers/nginx.conf /tmp/myapp.nginx
  74.  
  75. 32 RUN envsubst '$RAILS_ROOT' < /tmp/myappv.nginx > /etc/nginx/conf.d/default.conf
  76.  
  77. 35 CMD [ "nginx", "-g", "daemon off;" ]
  78.  
  79. 40 RUN bundle exec rake RAILS_ENV=$RAILS_ENV DATABASE_URL=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@127.0.0.1/$POSTGRES_PRODUCTION_DB assets:precompile
  80. 41 VOLUME ["$RAILS_ROOT/public"]
  81.  
  82. 46 CMD [ "config/containers/app_cmd.sh" ]
  83.  
  84. # *.env.production*
  85.  
  86. RAILS_ENV=production
  87. RAILS_ROOT=/var/www/eshop
  88. SECRET_KEY_BASE=the_long_code
  89. POSTGRES_PRODUCTION_DB=production_db
  90. POSTGRES_USER=postgres
  91. POSTGRES_PASSWORD=keep_secret_ps
  92.  
  93. web_1 | 2017/03/02 05:45:14 [warn] 1#1: server name "/var/www/eshop/public" has suspicious symbols in /etc/nginx/conf.d/default.conf:16
  94. web_1 | nginx: [warn] server name "/var/www/eshop/public" has suspicious symbols in /etc/nginx/conf.d/default.conf:16
  95.  
  96. RUN bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:pass@127.0.0.1/dbname SECRET_TOKEN=makeupasecret assets:precompile
  97.  
  98. VOLUME ["$RAILS_ROOT/public"]
  99.  
  100. version: '2'
  101. services:
  102. app:
  103. ...
  104. environment:
  105. - RAILS_SERVE_STATIC_FILES=true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement