diff --git a/.dockerignore b/.dockerignore index 0c80b26653..753923abc9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,7 @@ logs/ tmp/ node_modules/ +storage/ # Ignore bundler config. /.bundle @@ -24,6 +25,8 @@ coverage /public/c/* /public/i/* /public/assets/* +/public/packs-test/ +/public/creators-landing/node_modules/ # Ignore node_modules node_modules/ diff --git a/Dockerfile b/Dockerfile index 8351fe89be..ac1946a49c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,11 +11,13 @@ RUN apt-get install -y nodejs \ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + RUN ["rm", "-rf", "/var/lib/apt/lists/*"] ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 SHELL [ "/bin/bash", "-l", "-c" ] +ENV PATH="/root/.cargo/bin:${PATH}" RUN curl --silent -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash RUN gem install bundler @@ -35,6 +37,9 @@ COPY package.json yarn.lock .nvmrc ./ # Install the dependencies. RUN nvm install && nvm use +RUN gem install wasmer -v 1.0.0 +RUN bundle package --all +RUN bundle config set --local deployment 'true' RUN bundle check || PATH="/root/.cargo/bin:${PATH}" bundle install --jobs 20 --retry 5 RUN node --version RUN npm install -g yarn @@ -52,4 +57,3 @@ RUN bundle exec rails assets:precompile DB_ADAPTER=nulldb DATABASE_URL='nulldb:/ EXPOSE 3000 ENTRYPOINT [ "./scripts/entrypoint.sh" ] CMD ["bundle", "exec", "puma", "-C", "config/puma.rb", "-e","${RACK_ENV:-development}"] - diff --git a/Gemfile b/Gemfile index 60d5bfcbec..da66c3ad11 100644 --- a/Gemfile +++ b/Gemfile @@ -154,6 +154,11 @@ gem "zendesk_api", "~> 1.26.0" gem 'activerecord-nulldb-adapter', "0.7.0" +gem "wasm-thumbnail-rb", git: 'https://github.com/brave-intl/wasm-thumbnail.git', tag: '0.0.3', glob: 'wasm-thumbnail-rb/*.gemspec' + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] + group :development do gem "better_errors" gem "binding_of_caller" @@ -205,8 +210,3 @@ group :development, :test do gem 'solargraph' gem 'dotenv-rails', "2.7.6" end - -# Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] - -gem "wasm-thumbnail-rb", git: 'https://github.com/brave-intl/wasm-thumbnail.git', tag: '0.0.3' diff --git a/Gemfile.lock b/Gemfile.lock index a25a2a9cc0..453cbc2554 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,6 +2,7 @@ GIT remote: https://github.com/brave-intl/wasm-thumbnail.git revision: 73ae439ee366156fb2353015a9ee5d487502f2a7 tag: 0.0.3 + glob: wasm-thumbnail-rb/*.gemspec specs: wasm-thumbnail-rb (0.1.0) wasmer (~> 1.0) @@ -112,7 +113,7 @@ GEM autoprefixer-rails (10.3.1.0) execjs (~> 2) aws-eventstream (1.1.1) - aws-partitions (1.483.0) + aws-partitions (1.484.0) aws-sdk-core (3.119.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) @@ -664,4 +665,4 @@ RUBY VERSION ruby 2.7.3p183 BUNDLED WITH - 2.2.15 + 2.2.25 diff --git a/bin/bundle b/bin/bundle index 66e9889e8b..a71368e323 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,114 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -load Gem.bin_path('bundler', 'bundle') +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "rubygems" + +m = Module.new do + module_function + + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end + + def env_var_version + ENV["BUNDLER_VERSION"] + end + + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 + update_index = i + end + bundler_version + end + + def gemfile + gemfile = ENV["BUNDLE_GEMFILE"] + return gemfile if gemfile && !gemfile.empty? + + File.expand_path("../../Gemfile", __FILE__) + end + + def lockfile + lockfile = + case File.basename(gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end + + def lockfile_version + return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + Regexp.last_match(1) + end + + def bundler_version + @bundler_version ||= + env_var_version || cli_arg_version || + lockfile_version + end + + def bundler_requirement + return "#{Gem::Requirement.default}.a" unless bundler_version + + bundler_gem_version = Gem::Version.new(bundler_version) + + requirement = bundler_gem_version.approximate_recommendation + + return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") + + requirement += ".a" if bundler_gem_version.prerelease? + + requirement + end + + def load_bundler! + ENV["BUNDLE_GEMFILE"] ||= gemfile + + activate_bundler + end + + def activate_bundler + gem_error = activation_error_handling do + gem "bundler", bundler_requirement + end + return if gem_error.nil? + require_error = activation_error_handling do + require "bundler/version" + end + return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end +end + +m.load_bundler! + +if m.invoked_as_script? + load Gem.bin_path("bundler", "bundle") +end