FROM ruby:2.2.3 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 mysql-client #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 # Copy site into place. RUN rm -rf /var/www WORKDIR /var/www/ ADD . /var/www/ RUN RAILS_ENV=production bundle exec rake db:migrate RUN RAILS_ENV=production bundle exec rake assets:precompile # 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 # By default, simply start apache. CMD /usr/sbin/apache2ctl -D FOREGROUND