diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml new file mode 100644 index 00000000..6c94e191 --- /dev/null +++ b/.github/workflows/docker_build.yml @@ -0,0 +1,16 @@ +name: Docker Build + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + services: + steps: + - uses: actions/checkout@v4 + - name: Build docker + run: docker build . + - name: Test docker compose + run: docker-compose up -d + - name: Check server is up + run: curl -s http://localhost:3000 diff --git a/Dockerfile b/Dockerfile index f3943b14..191025b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.7 AS builder +FROM ruby:3.2 AS builder RUN apt-get update && apt-get upgrade -y && apt-get install -y ca-certificates curl gnupg && \ curl -fsSL https://deb.nodesource.com/setup_21.x | bash - && \ @@ -64,7 +64,7 @@ RUN mv config/credentials.bak config/credentials 2>/dev/null || true RUN rm -rf tmp/cache vendor/bundle test spec .git # This image is for production env only -FROM ruby:2.7-slim AS final +FROM ruby:3.2-slim AS final RUN apt-get update && \ apt-get install -y postgresql-client \ diff --git a/Gemfile b/Gemfile index d3790e4a..09e9249b 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ gem 'aws-sdk-s3', '~> 1.94', require: false gem 'image_processing', '~> 1.12' gem 'active_storage_validations', '~> 1.1.3' gem "puma", ">= 5.0.0" +gem 'matrix', '~> 0.4.1' # Assets gem 'jquery-rails', '~> 4.4.0' diff --git a/Gemfile.lock b/Gemfile.lock index 68107a4e..b0d22f46 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -452,6 +452,7 @@ DEPENDENCIES kaminari (~> 1.2.1) letter_opener (~> 1.7.0) localeapp (~> 3.3) + matrix (~> 0.4.1) pg (~> 1.4) pg_search (~> 2.3.5) prawn (~> 2.4.0) diff --git a/app/assets/javascripts/libs.js b/app/assets/javascripts/libs.js index 1c941bd1..7f1ebda1 100644 --- a/app/assets/javascripts/libs.js +++ b/app/assets/javascripts/libs.js @@ -1,7 +1,7 @@ //= require jquery2 //= require jquery_ujs -//= require jquery.validate +//= require vendor/jquery.validate //= require bootstrap -//= require highcharts -//= require highcharts-exporting +//= require vendor/highcharts +//= require vendor/highcharts-exporting //= require select2 diff --git a/config/application.rb b/config/application.rb index b98b2311..40e52935 100644 --- a/config/application.rb +++ b/config/application.rb @@ -31,6 +31,7 @@ class Application < Rails::Application config.active_record.schema_format = :sql # Guard against DNS rebinding attacks by permitting hosts + # localhost is necessary for the docker image config.hosts << 'localhost' config.hosts << 'timeoverflow.local' config.hosts << 'staging.timeoverflow.org' diff --git a/config/environments/production.rb b/config/environments/production.rb index 34ae293a..51695aff 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,4 @@ +# Uglifier is only used on the precompile phase, so we can require it conditionally require "uglifier" if ENV["SECRET_KEY_BASE"] == "dummy" Rails.application.configure do @@ -57,9 +58,7 @@ # Use the lowest log level to ensure availability of diagnostic information # when problems arise. - config.log_level = if %w(debug info warn error - fatal).include?(ENV.fetch("RAILS_LOG_LEVEL", - nil)) + config.log_level = if %w(debug info warn error fatal).include?(ENV.fetch("RAILS_LOG_LEVEL", nil)) ENV["RAILS_LOG_LEVEL"] else :info