Advertisement
Guest User

Untitled

a guest
Mar 19th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. default: &default
  2. adapter: postgresql
  3. pool: 5
  4. user: pguser
  5. password: pguser
  6. timeout: 5000
  7. host: localhost
  8. encoding: utf8
  9. port: 5432
  10.  
  11. production:
  12. <<: *default
  13. database: myapp_production
  14.  
  15. # Use phusion/passenger-full as base image. To make your builds reproducible, make
  16. # sure you lock down to a specific version, not to `latest`!
  17. # See https://github.com/phusion/passenger-docker/blob/master/Changelog.md for
  18. # a list of version numbers.
  19. FROM phusion/passenger-full:0.9.18
  20.  
  21. # Set correct environment variables.
  22. ENV HOME /root
  23.  
  24. # Use baseimage-docker's init process.
  25. CMD ["/sbin/my_init"]
  26.  
  27. # ...put your own build instructions here...
  28.  
  29. RUN rm -f /etc/service/nginx/down
  30.  
  31. # Expose Nginx HTTP service
  32. EXPOSE 80
  33.  
  34. # Remove the default site
  35. RUN rm /etc/nginx/sites-enabled/default
  36.  
  37. # Add the nginx site and config
  38. ADD myapp.conf /etc/nginx/sites-enabled/myapp.conf
  39. ADD rails-env.conf /etc/nginx/main.d/rails-env.conf
  40.  
  41. ###### Andrea Grandi https://github.com/andreagrandi/postgresql-docker/blob/master/Dockerfile ######
  42.  
  43. # Add the PostgreSQL PGP key to verify their Debian packages.
  44. # It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
  45. RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
  46.  
  47. # Add PostgreSQL's repository. It contains the most recent stable release
  48. # of PostgreSQL, ``9.3``.
  49. RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
  50.  
  51. # Update the Ubuntu and PostgreSQL repository indexes and install ``python-software-properties``,
  52. # ``software-properties-common`` and PostgreSQL 9.3
  53. # There are some warnings (in red) that show up during the build. You can hide
  54. # them by prefixing each apt-get statement with DEBIAN_FRONTEND=noninteractive
  55. RUN apt-get update && apt-get -y -q install python-software-properties software-properties-common
  56. && apt-get -y -q install postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3
  57.  
  58. USER postgres
  59.  
  60. RUN /etc/init.d/postgresql start
  61. && psql --command "CREATE USER pguser WITH SUPERUSER PASSWORD 'pguser';"
  62. && createdb -O pguser myapp_production
  63.  
  64. USER root
  65.  
  66. # Adjust PostgreSQL configuration so that remote connections to the
  67. # database are possible.
  68. RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf
  69.  
  70. # And add ``listen_addresses`` to ``/etc/postgresql/9.3/main/postgresql.conf``
  71. RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf
  72.  
  73. # Expose the PostgreSQL port
  74. EXPOSE 5432
  75.  
  76. RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
  77.  
  78. # Add VOLUMEs to allow backup of config, logs and databases
  79. VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]
  80.  
  81. USER postgres
  82.  
  83. # Set the default command to run when starting the container
  84. CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"]
  85.  
  86. ###### /Andrea Grandi https://github.com/andreagrandi/postgresql-docker/blob/master/Dockerfile ######
  87.  
  88. USER root
  89.  
  90. # Add the Rails app
  91. RUN mkdir /home/app/MyApp
  92. WORKDIR /home/app/MyApp
  93. ADD . /home/app/MyApp
  94. RUN chown -R app:app /home/app/MyApp
  95.  
  96. # Install bundle of gems
  97. RUN apt-get install pkg-config
  98. RUN apt-get install libgmp-dev
  99. RUN bundle config build.nokogiri --use-system-libraries
  100. RUN bundle install
  101.  
  102. # run migrations
  103. RUN RAILS_ENV=production rake db:migrate --trace
  104. RUN rake db:seed
  105.  
  106. #enable memcached
  107. #RUN rm -f /etc/service/memcached/down
  108.  
  109. # Clean up APT when done.
  110. RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement