From 225e90ca8f257c28a25642c5d07b462b483db37d Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Sat, 14 May 2016 11:20:28 -0400 Subject: [PATCH] Get frontend javascript into the docker image. Still need to figure out how to get frontend templates into rails. --- config/environments/production.rb | 3 +++ deploy/deploy-test.sh | 3 ++- frontend/config/application.js | 4 ++++ rails-prod-Dockerfile | 11 +++++++---- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 33ca8d1..44552b6 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -110,4 +110,7 @@ Wrestling::Application.configure do config.action_mailer.perform_deliveries = true #Devise needs origin of email Rails.application.routes.default_url_options[:host] = 'https://wrestlingdev.com' + + #For lineman creating assets + config.serve_static_files = true end diff --git a/deploy/deploy-test.sh b/deploy/deploy-test.sh index 0b6b3fc..21116f5 100755 --- a/deploy/deploy-test.sh +++ b/deploy/deploy-test.sh @@ -1,5 +1,6 @@ cd .. -bash rails-prod.sh wrestlingdev +docker build -t wrestlingdev -f rails-prod-Dockerfile . cd deploy +docker-compose -f docker-compose-test.yml kill docker-compose -f docker-compose-test.yml up -d echo Make sure your local mysql database has a wrestlingtourney db diff --git a/frontend/config/application.js b/frontend/config/application.js index 6a7ddf8..5eb19e0 100644 --- a/frontend/config/application.js +++ b/frontend/config/application.js @@ -33,6 +33,10 @@ module.exports = function(lineman) { } }, + removeTasks: { + common: ["jshint"] + }, + // Sass // // Lineman supports Sass via grunt-contrib-sass, which requires you first diff --git a/rails-prod-Dockerfile b/rails-prod-Dockerfile index db3326a..e5b90a5 100644 --- a/rails-prod-Dockerfile +++ b/rails-prod-Dockerfile @@ -54,6 +54,7 @@ RUN bundle install --without test WORKDIR /tmp COPY frontend/package.json package.json RUN npm install +RUN npm install lineman RUN npm install -g lineman # Copy site into place. @@ -64,9 +65,13 @@ ENV WRESTLINGDEV_SECRET_KEY_BASE 077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e446 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 @@ -78,9 +83,7 @@ RUN a2ensite default-ssl.conf RUN echo PassengerMaxPoolSize 3 >> /etc/apache2/apache2.conf RUN echo PassengerMinInstances 3 >> /etc/apache2/apache2.conf RUN echo PassengerPreStart *:443 >> /etc/apache2/apache2.conf - -#Copy node_modules to /var/www -RUN mv /tmp/node_modules /var/www/frontend/node_modules + # By default, simply start apache. CMD /usr/sbin/apache2ctl -D FOREGROUND