Guest User

Untitled

a guest
Sep 10th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. server {
  2. listen 80;
  3.  
  4. # Allow nginx to serve assets from docker
  5. location ^~ /my-app/assets/ {
  6. rewrite /my-app(/assets/.*) $1;
  7. root /app/public/;
  8. gzip_static on;
  9. expires max;
  10. add_header Cache-Control public;
  11. add_header Strict-Transport-Security "";
  12. }
  13.  
  14. # Allow nginx to serve assets from ALB
  15. location ^~ /assets/ {
  16. root /app/public/;
  17. gzip_static on;
  18. expires max;
  19. add_header Cache-Control public;
  20. add_header Strict-Transport-Security "";
  21. }
  22.  
  23. location / {
  24. proxy_pass http://my-app:3000;
  25. add_header Strict-Transport-Security "";
  26. }
  27. }
  28.  
  29. version: "3.4"
  30. services:
  31. my-app:
  32. build:
  33. context: .
  34. target: my-app
  35. restart: "no"
  36. env_file:
  37. ./.my-app.env
  38. links:
  39. - postgres
  40. command: >
  41. /bin/bash -c "
  42. while ! nc -z postgres 5432;
  43. do
  44. echo waiting for postgres;
  45. sleep 1;
  46. done;
  47. echo Connected!;
  48. bundle exec rake db:create db:migrate;
  49. rm -f /app/tmp/pids/server.pid
  50. bundle exec rake assets:clobber
  51. bundle exec rake assets:precompile RAILS_ENV=production
  52. bundle exec rake assets:precompile RAILS_ENV=staging
  53. bundle exec rails server;
  54. "
  55. postgres:
  56. image: postgres:9.6
  57. environment:
  58. POSTGRES_USER: postgres
  59. POSTGRES_PASSWORD: postgres
  60. ports:
  61. - '5432:5432'
  62. my-app-nginx:
  63. build:
  64. context: .
  65. target: nginx
  66. links:
  67. - skymap
  68. restart: "no"
  69. ports:
  70. - '3000:80'
  71.  
  72. # Start NGINX container config
  73. FROM nginx as nginx
  74. WORKDIR /public
  75. COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
  76. COPY public /public
Add Comment
Please, Sign In to add comment