Skip to content

Commit 745ad81

Browse files
committed
Update Live demo
1 parent f4cf4b6 commit 745ad81

File tree

11 files changed

+321
-31
lines changed

11 files changed

+321
-31
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ jobs:
150150
run: |
151151
yarn install
152152
cd spec/dummy_app
153-
bundle exec rake rails_admin:prepare_ci_env db:create db:migrate
153+
bundle exec rake rails_admin:prepare_ci_env db:create db:schema:load
154154
yarn install
155155
case "$CI_ASSET" in
156156
"webpack" ) yarn build && yarn build:css ;;

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ log/*.log
2424
pkg/*
2525
spec/dummy_app/db/*.sqlite3
2626
spec/dummy_app/db/*.sqlite3-journal
27-
spec/dummy_app/db/schema.rb
2827
spec/dummy_app/log/*.log
2928
spec/dummy_app/public/uploads
3029
spec/dummy_app/Gemfile*.lock

spec/dummy_app/.dockerignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
# Ignore git directory.
44
/.git/
55

6-
# Ignore bundler config.
6+
# Ignore bundler config and Gemfile.lock.
77
/.bundle
8+
/Gemfile.lock
89

910
# Ignore all default key files.
1011
/config/master.key

spec/dummy_app/Dockerfile

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# syntax = docker/dockerfile:1
22

33
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
4-
ARG RUBY_VERSION=3.1.2
5-
FROM ruby:$RUBY_VERSION-slim as base
4+
ARG RUBY_VERSION=3.2
5+
FROM ruby:$RUBY_VERSION-slim AS base
66

77
LABEL fly_launch_runtime="rails"
88

@@ -30,29 +30,27 @@ RUN apt-get update -qq && \
3030
# rm -rf /tmp/node-build-master
3131

3232
# Throw-away build stage to reduce size of final image
33-
FROM base as build
33+
FROM base AS build
3434

3535
# Install packages needed to build gems and node modules
3636
RUN apt-get update -qq && \
37-
apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev git libpq-dev libvips node-gyp pkg-config python-is-python3
37+
apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev git libpq-dev libvips libyaml-dev node-gyp pkg-config python-is-python3
3838

3939
# Build options
4040
ENV PATH="/usr/local/node/bin:$PATH"
4141

42-
# Install application gems
43-
COPY --link Gemfile ./
44-
RUN sed -i "s/, path: '..\/..\/'//" Gemfile
42+
# Copy application code
43+
COPY --link . .
44+
45+
# Install application gems. Using Rails 7 for now, as 8 seems to consume more memory.
46+
RUN sed -i "s/, path: '..\/..\/'//" Gemfile && sed -i "s/'rails', '>= 7.0.0'/'rails', '~> 7.0'/" Gemfile
4547
RUN bundle install && \
4648
rm -rf ~/.bundle/ $BUNDLE_PATH/ruby/*/cache $BUNDLE_PATH/ruby/*/bundler/gems/*/.git
4749

4850
# Install node modules
4951
# COPY --link package.json ./
5052
# RUN npm install
5153

52-
# Copy application code
53-
COPY --link . .
54-
RUN sed -i "s/, path: '..\/..\/'//" Gemfile
55-
5654
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
5755
RUN sed -i "/link_tree ..\/..\/..\//d" app/assets/config/manifest.js
5856
RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile

spec/dummy_app/bin/docker-entrypoint

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# If running the rails server then create or migrate existing database
44
if [ "${*}" == "./bin/rails server" ]; then
5-
./bin/rails db:create db:migrate db:seed
5+
./bin/rails db:setup
66
fi
77

88
exec "${@}"

spec/dummy_app/config/application.rb

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class Application < Rails::Application
3737
# Application configuration should go into files in config/initializers
3838
# -- all .rb files in that directory are automatically loaded.
3939
config.load_defaults Rails.version[0, 3]
40+
(CI_TARGET_ORMS - [CI_ORM]).each {|orm| config.paths.add "app/#{orm}", eager_load: false }
4041
config.eager_load_paths = (config.try(:all_eager_load_paths) || config.eager_load_paths).reject { |p| p =~ %r{/app/([^/]+)} && !%W[controllers jobs locales mailers #{CI_ORM}].include?(Regexp.last_match[1]) }
4142
config.eager_load_paths += %W[#{config.root}/app/eager_loaded]
4243
config.autoload_paths += %W[#{config.root}/lib]

spec/dummy_app/config/boot.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
CI_ORM = (ENV['CI_ORM'] || :active_record).to_sym unless defined?(CI_ORM)
4+
CI_TARGET_ORMS = %i[active_record mongoid].freeze
45
CI_ASSET = (ENV['CI_ASSET'] || :sprockets).to_sym unless defined?(CI_ASSET)
56
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
67

spec/dummy_app/config/initializers/rails_admin.rb

+5
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,10 @@
1616
visible false
1717
end
1818
end
19+
c.model 'League' do
20+
configure :players do
21+
visible false
22+
end
23+
end
1924
end
2025
end

0 commit comments

Comments
 (0)