From be84e7e4ed0cc71957a5340dcca836f416427566 Mon Sep 17 00:00:00 2001 From: Jesus Federico Date: Wed, 22 May 2019 12:03:06 -0400 Subject: [PATCH] Updated Gemfile and scripts for supporting Heroku (#542) * Include sqlite only for test and development * Updated db config * added assed precompile as a fallback for production * restored some code from Gemfile * Restored db settings * Restored db settings * Include sqlite for production in the docker image build * Updated script for building image * Updated script for building image * Updated script for building image --- Gemfile | 5 ++--- config/environments/production.rb | 2 +- scripts/image_build.sh | 4 +++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index fbf7845a..cad426e4 100644 --- a/Gemfile +++ b/Gemfile @@ -13,9 +13,6 @@ gem 'rails', '~> 5.0.7' # Use Puma as the app server gem 'puma', '~> 3.0' -# Use SQLite as the primary database. -gem 'sqlite3', '~> 1.3' - # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' @@ -89,6 +86,8 @@ group :development, :test do gem 'byebug', platform: :mri # Environment configuration. gem 'dotenv-rails' + # Use a sqlite database in test and development. + gem 'sqlite3', '~> 1.3' end group :test do diff --git a/config/environments/production.rb b/config/environments/production.rb index 837327dc..c83f56eb 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -25,7 +25,7 @@ Rails.application.configure do # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false + config.assets.compile = true # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb diff --git a/scripts/image_build.sh b/scripts/image_build.sh index 3075e92f..09ee975f 100755 --- a/scripts/image_build.sh +++ b/scripts/image_build.sh @@ -53,11 +53,13 @@ if [ -z $CD_DOCKER_REPO ]; then export CD_DOCKER_REPO=$CD_REF_SLUG fi -if [ "$CD_REF_NAME" != "master" ] && [[ "$CD_REF_NAME" != *"release"* ]] && ( -z $CD_BUILD_ALL ] || [ "$CD_BUILD_ALL" != "true" ] ); then +if [ "$CD_REF_NAME" != "master" ] && [[ "$CD_REF_NAME" != *"release"* ]] && ( [ -z "$CD_BUILD_ALL" ] || [ "$CD_BUILD_ALL" != "true" ] ); then echo "#### Docker image for $CD_REF_SLUG won't be built" exit 0 fi +# Include sqlite for production +sed -i "/^group :production do/a\ \ gem 'sqlite3', '~> 1.3'" Gemfile # Set the version tag when it is a release or the commit sha was included. if [[ "$CD_REF_NAME" == *"release"* ]]; then sed -i "s/VERSION =.*/VERSION = \"${CD_REF_NAME:8}\"/g" config/initializers/version.rb