FROM ruby:2.3.0 RUN apt-get update RUN apt-get -y upgrade RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libssl-dev libyaml-dev libreadline-dev openssl curl git-core zlib1g-dev bison libxml2-dev libxslt1-dev libcurl4-openssl-dev libsqlite3-dev sqlite3 wget apache2 apt-transport-https nodejs nodejs-legacy npm mysql-client postfix #New Relic #RUN echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list #RUN wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add - #RUN apt-get update #RUN apt-get install newrelic-sysmond -y #RUN nrsysmond-config --set license_key=$NEW_RELIC_LICENSE_KEY #Passenger RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7 RUN echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main >> /etc/apt/sources.list.d/passenger.list RUN chown root: /etc/apt/sources.list.d/passenger.list RUN chmod 600 /etc/apt/sources.list.d/passenger.list RUN apt-get update RUN apt-get install -y libapache2-mod-passenger # Enable apache mods. RUN a2enmod rewrite RUN a2enmod proxy RUN a2enmod proxy_http RUN a2enmod passenger RUN a2enmod ssl #SSL RUN mkdir /etc/apache2/ssl RUN openssl req -sha256 -subj '/CN=home/O=home LTD./C=US' -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt # Manually set up the apache environment variables ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 ENV APACHE_LOCK_DIR /var/lock/apache2 ENV APACHE_PID_FILE /var/run/apache2.pid EXPOSE 80 EXPOSE 443 #Cache gems so they don't install on every code change WORKDIR /tmp COPY Gemfile Gemfile COPY Gemfile.lock Gemfile.lock RUN bundle install --without test #Cache node_modules WORKDIR /tmp COPY frontend/package.json package.json RUN npm install RUN npm install lineman RUN npm install -g lineman # Copy site into place. RUN rm -rf /var/www ENV WRESTLINGDEV_SECRET_KEY_BASE 077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2 ENV WRESTLINGDEV_DEVISE_SECRET_KEY 2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa WORKDIR /var/www/ ADD . /var/www/ #Copy node_modules to /var/www RUN mv /tmp/node_modules /var/www/frontend/node_modules #RUN RAILS_ENV=production bundle exec rake db:migrate RUN RAILS_ENV=production bundle exec rake assets:precompile #RUN cp /var/www/frontend/dist/*.html /var/www/public/ # Update the default apache site with the config we created. RUN rm /etc/apache2/sites-enabled/000-default.conf ADD ./rails-apache-ssl-config.conf /etc/apache2/sites-available/default-ssl.conf ADD ./rails-apache-config.conf /etc/apache2/sites-enabled/000-default.conf RUN a2ensite default-ssl.conf # Add apache tuning stuff RUN echo PassengerMaxPoolSize 3 >> /etc/apache2/apache2.conf RUN echo PassengerMinInstances 3 >> /etc/apache2/apache2.conf RUN echo PassengerPreStart *:443 >> /etc/apache2/apache2.conf # By default, simply start apache. CMD /usr/sbin/apache2ctl -D FOREGROUND