diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..0da30ab5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +# Don't include any of these files in the Dockerfile build context. +# This will improve build performance and reduce the final image size. +# See: https://docs.docker.com/engine/reference/builder/#dockerignore-file +.git/ +.github/ +.coveralls.yml +.dockerignore +.editorconfig +.gitignore +.travis.yml +.rubocop.yml +CHANGELOG.md +docker-compose.yml +log/ +test/ diff --git a/.ruby-version b/.ruby-version index a6e69306..338a5b5d 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1,2 +1 @@ 2.6.6 - diff --git a/Dockerfile b/Dockerfile index 36b7b7d4..e4c9c96d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,32 @@ +# HEADS UP! +# This Dockerfile is for DEVELOPMENT use only; +# it's in no way optimized for production. + +# The image to build from. FROM ruby:2.6.3 -RUN apt-get update -qq && \ + +# Properties/labels for the image. +LABEL maintainer="Notebook.ai Contributors" + +# Copy the current folder into the notebookai user's home directory. +COPY . /home/notebookai + +# Set the notebookai user's home directory as the working directory. +WORKDIR /home/notebookai + +# Prep the image for runtime, this should all be done in one command +# to minimize image layers. +# See: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers +RUN groupadd --system --gid 1000 notebookai && \ + useradd --system --home-dir /home/notebookai --gid notebookai --uid 1000 --shell /bin/bash notebookai && \ + apt-get update -qq && \ apt-get install -y build-essential libpq-dev nodejs imagemagick libmagickwand-dev && \ - mkdir /notebook-ai -COPY . /notebook-ai -WORKDIR /notebook-ai -RUN bundle install -RUN rails db:setup + rm --recursive --force /var/lib/apt/lists/* && \ + bundle install && \ + rails db:setup + +# This image should expose the port 3000. +# This does not actually expose the port, you'll have to expose it yourself by +# using `-p 3000:3000/tcp` in Docker's CLI or `- "3000:3000"` in the in docker-compose.yml service's ports[]. +# https://docs.docker.com/engine/reference/builder/#expose +EXPOSE 3000/tcp diff --git a/Gemfile b/Gemfile index f8c54894..0373b620 100644 --- a/Gemfile +++ b/Gemfile @@ -131,7 +131,7 @@ group :test do gem 'webmock' gem 'rubocop', require: false gem 'ruby-prof', '1.4.1' - gem 'shoulda-matchers', '~> 4.3' + gem 'shoulda-matchers', '~> 4.4' gem 'rails-controller-testing' end diff --git a/Gemfile.lock b/Gemfile.lock index ee30f010..f4175dd7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -79,7 +79,7 @@ GEM rails-html-sanitizer (~> 1.1, >= 1.2.0) active_record_union (1.3.0) activerecord (>= 4.0) - active_storage_validations (0.8.8) + active_storage_validations (0.9.0) rails (>= 5.2.0) activejob (6.0.3.2) activesupport (= 6.0.3.2) @@ -1024,9 +1024,9 @@ GEM bullet (6.1.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) - bundler-audit (0.6.1) + bundler-audit (0.7.0.1) bundler (>= 1.2.0, < 3) - thor (~> 0.18) + thor (>= 0.18, < 2) capybara (3.33.0) addressable mini_mime (>= 0.1.3) @@ -1054,7 +1054,7 @@ GEM crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.6) - csv (3.1.5) + csv (3.1.7) cucumber (4.1.0) builder (~> 3.2, >= 3.2.3) cucumber-core (~> 7.1, >= 7.1.0) @@ -1173,7 +1173,7 @@ GEM domain_name (~> 0.5) http-form_data (2.3.0) http_parser.rb (0.6.0) - i18n (1.8.3) + i18n (1.8.5) concurrent-ruby (~> 1.0) ibm_cloud_sdk_core (1.1.1) concurrent-ruby (~> 1.0) @@ -1218,11 +1218,11 @@ GEM kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) language_filter (0.3.01) - libv8 (7.3.492.27.1) + libv8 (8.4.255.0) listen (3.2.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.6.0) + loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.4) @@ -1246,8 +1246,8 @@ GEM mini_magick (4.10.1) mini_mime (1.0.2) mini_portile2 (2.4.0) - mini_racer (0.2.15) - libv8 (> 7.3) + mini_racer (0.3.1) + libv8 (~> 8.4.255) minitest (5.14.1) mixpanel-ruby (2.2.2) multi_json (1.14.1) @@ -1282,7 +1282,7 @@ GEM parallel (1.19.2) paranoia (2.4.2) activerecord (>= 4.0, < 6.1) - parser (2.7.1.4) + parser (2.7.1.5) ast (~> 2.4.1) paypal-checkout-sdk (1.0.3) paypalhttp (~> 1.0.0) @@ -1383,7 +1383,7 @@ GEM tilt redcarpet (3.5.0) redis (4.2.1) - regexp_parser (1.7.1) + regexp_parser (1.8.0) remotipart (1.4.4) responders (3.0.1) actionpack (>= 5.0) @@ -1415,17 +1415,17 @@ GEM rspec-mocks (~> 3.9) rspec-support (~> 3.9) rspec-support (3.9.3) - rubocop (0.88.0) + rubocop (0.92.0) parallel (~> 1.10) - parser (>= 2.7.1.1) + parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.7) rexml - rubocop-ast (>= 0.1.0, < 1.0) + rubocop-ast (>= 0.5.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.1.0) - parser (>= 2.7.0.1) + rubocop-ast (0.5.1) + parser (>= 2.7.1.5) ruby-prof (1.4.1) ruby-progressbar (1.10.1) ruby-vips (2.0.17) @@ -1451,7 +1451,7 @@ GEM rubyzip (>= 1.2.2) semantic_range (2.3.0) shellany (0.0.1) - shoulda-matchers (4.3.0) + shoulda-matchers (4.4.1) activesupport (>= 4.2.0) sidekiq (6.1.1) connection_pool (>= 2.2.2) @@ -1489,7 +1489,7 @@ GEM text-hyphen (1.4.1) textstat (0.1.6) text-hyphen (~> 1.4, >= 1.4.1) - thor (0.20.3) + thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) timeago_js (3.0.2.2) @@ -1507,7 +1507,7 @@ GEM uniform_notifier (1.13.0) warden (1.2.8) rack (>= 2.0.6) - web-console (4.0.3) + web-console (4.0.4) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) @@ -1516,7 +1516,7 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webpacker (5.1.1) + webpacker (5.2.1) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) @@ -1603,7 +1603,7 @@ DEPENDENCIES sass-rails selenium-webdriver serendipitous! - shoulda-matchers (~> 4.3) + shoulda-matchers (~> 4.4) sidekiq simplecov slack-notifier diff --git a/docker-compose.yml b/docker-compose.yml index 577193d9..3eb3943e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,9 @@ -version: '2' +version: "3.8" services: - web: - build: . - command: sh -c "rake db:migrate && rm -f tmp/pids/server.pid && exec bundle exec rails server -b '0.0.0.0'" - volumes: - - .:/notebook-ai - ports: - - "3000:3000" + notebookai: + build: . + ports: + - "3000:3000/tcp" + command: sh -c "rake db:migrate && rm -f tmp/pids/server.pid && exec bundle exec rails server -b 0.0.0.0" + volumes: + - "./:/notebook-ai" diff --git a/yarn.lock b/yarn.lock index e8eb501a..41bf3243 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4376,9 +4376,9 @@ etag@~1.8.1: integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= eventemitter3@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.0.tgz#d65176163887ee59f386d64c82610b696a4a74eb" - integrity sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg== + version "4.0.7" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" + integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== events@^3.0.0: version "3.1.0" @@ -4765,11 +4765,9 @@ follow-redirects@1.5.10: debug "=3.1.0" follow-redirects@^1.0.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.10.0.tgz#01f5263aee921c6a54fb91667f08f4155ce169eb" - integrity sha512-4eyLK6s6lH32nOvLLwlIOnr9zrL8Sm+OvW4pVTJNoXeGzYIkHVf+pADQi+OJ0E67hiuSLezPVPyBcIZO50TmmQ== - dependencies: - debug "^3.0.0" + version "1.13.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db" + integrity sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA== for-in@^0.1.3: version "0.1.8" @@ -5443,9 +5441,9 @@ http-proxy-middleware@0.19.1: micromatch "^3.1.10" http-proxy@^1.17.0: - version "1.18.0" - resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.0.tgz#dbe55f63e75a347db7f3d99974f2692a314a6a3a" - integrity sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ== + version "1.18.1" + resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" + integrity sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ== dependencies: eventemitter3 "^4.0.0" follow-redirects "^1.0.0" @@ -6665,9 +6663,9 @@ map-visit@^1.0.0: object-visit "^1.0.0" markdown-to-jsx@^6.9.1, markdown-to-jsx@^6.9.3: - version "6.10.3" - resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.10.3.tgz#7f0946684acd321125ff2de7fd258a9b9c7c40b7" - integrity sha512-PSoUyLnW/xoW6RsxZrquSSz5eGEOTwa15H5eqp3enmrp8esmgDJmhzd6zmQ9tgAA9TxJzx1Hmf3incYU/IamoQ== + version "6.11.4" + resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.11.4.tgz#b4528b1ab668aef7fe61c1535c27e837819392c5" + integrity sha512-3lRCD5Sh+tfA52iGgfs/XZiw33f7fFX9Bn55aNnVNUd2GzLDkOWyKYYD8Yju2B1Vn+feiEdgJs8T6Tg0xNokPw== dependencies: prop-types "^15.6.2" unquote "^1.1.0" @@ -7090,9 +7088,9 @@ node-dir@^0.1.10: minimatch "^3.0.2" node-fetch@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== node-forge@0.9.0: version "0.9.0" @@ -8952,11 +8950,16 @@ react-inspector@^4.0.0: prop-types "^15.6.1" storybook-chromatic "^2.2.2" -react-is@^16.7.0, react-is@^16.8.0, react-is@^16.8.1: +react-is@^16.7.0, react-is@^16.8.0: version "16.12.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== +react-is@^16.8.1: + version "16.13.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + react-lifecycles-compat@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"