From 3d9b87d0cdca379c3acab42b95a806c66dcde9ef Mon Sep 17 00:00:00 2001 From: icyleaf Date: Fri, 24 Jul 2020 14:58:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=20bootstrap=20?= =?UTF-8?q?=E5=9C=A8=20docker=20=E6=97=A0=E6=B3=95=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#235)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 +-- Gemfile | 2 +- Gemfile.lock | 4 ++-- config/application.rb | 2 +- config/boot.rb | 9 +++------ config/webpacker.yml | 6 +----- docker/rootfs/etc/cont-init.d/20-init-zealot | 2 +- docker/rootfs/etc/services.d/zealot/run | 6 ++++++ 8 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7d072711a..4b760989c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -84,8 +84,7 @@ ENV TZ="Asia/Shanghai" \ BUNDLE_APP_CONFIG="$APP_ROOT/.bundle" \ ZEALOT_VCS_REF="$VCS_REF" \ ZEALOT_VERSION="$ZEALOT_VERSION" \ - RAILS_ENV="production" \ - ENABLE_BOOTSNAP="false" + RAILS_ENV="production" # System dependencies RUN set -ex && \ diff --git a/Gemfile b/Gemfile index 822aed953..7e2e097c8 100644 --- a/Gemfile +++ b/Gemfile @@ -83,7 +83,7 @@ gem 'app-info', '~> 2.2.0' gem 'rails-settings-cached', '~> 2.2' # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.4.4', require: false +gem 'bootsnap', '>= 1.4.7', require: false group :development do # 调试控制台 diff --git a/Gemfile.lock b/Gemfile.lock index fca5f5837..61c4db351 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,7 +85,7 @@ GEM bindex (0.8.1) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) - bootsnap (1.4.6) + bootsnap (1.4.7) msgpack (~> 1.0) builder (3.2.4) byebug (11.0.1) @@ -462,7 +462,7 @@ DEPENDENCIES awesome_print better_errors binding_of_caller - bootsnap (>= 1.4.4) + bootsnap (>= 1.4.7) byebug carrierwave debase diff --git a/config/application.rb b/config/application.rb index 1beecd04b..f59a9f7d4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -92,6 +92,6 @@ class Application < Rails::Application config.generators.system_tests = nil # Disable yarn check(this must disable with docker) - config.webpacker.check_yarn_integrity = false + # config.webpacker.check_yarn_integrity = false end end diff --git a/config/boot.rb b/config/boot.rb index b728a1e4b..c04863fa7 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,9 +1,6 @@ +# frozen_string_literal: true + ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. - -# Broken in docker image, need set it false -# Ref: https://github.com/Shopify/bootsnap/issues/262 -if ENV.fetch('ENABLE_BOOTSNAP', 'true') == 'true' - require 'bootsnap/setup' # Speed up boot time by caching expensive operations. -end +require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/config/webpacker.yml b/config/webpacker.yml index 7e38f01b7..a60a592ed 100644 --- a/config/webpacker.yml +++ b/config/webpacker.yml @@ -6,7 +6,6 @@ default: &default public_root_path: public public_output_path: packs cache_path: tmp/cache/webpacker - check_yarn_integrity: false webpack_compile_output: false # Additional paths webpack should lookup modules @@ -17,7 +16,7 @@ default: &default cache_manifest: false # Extract and emit a css file - extract_css: false + extract_css: true static_assets_extensions: - .jpg @@ -53,9 +52,6 @@ development: <<: *default compile: true - # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules - check_yarn_integrity: true - # Reference: https://webpack.js.org/configuration/dev-server/ dev_server: https: false diff --git a/docker/rootfs/etc/cont-init.d/20-init-zealot b/docker/rootfs/etc/cont-init.d/20-init-zealot index 0887a4183..d11a92177 100644 --- a/docker/rootfs/etc/cont-init.d/20-init-zealot +++ b/docker/rootfs/etc/cont-init.d/20-init-zealot @@ -11,7 +11,7 @@ if [ -d "new_public" ]; then echo "Zealot updating public ..." for x in public/*; do if [ -z $(echo "$x" | grep uploads) ]; then - rm -rf "$x" + rm -rf "$x" > /dev/null fi done diff --git a/docker/rootfs/etc/services.d/zealot/run b/docker/rootfs/etc/services.d/zealot/run index f2bf54d76..d7fe6a6bd 100644 --- a/docker/rootfs/etc/services.d/zealot/run +++ b/docker/rootfs/etc/services.d/zealot/run @@ -1,5 +1,11 @@ #!/usr/bin/with-contenv sh +echo "========================================" +echo " Zealot had change run-way inside, if fail to run make sure " +echo " to upgrade the zealot-docker repospitory and re-generate the docker-compose.yml!" +echo "========================================" +echo + echo "Starting Zealot" cd /app bundle exec puma -C config/puma.rb | tee /app/log/zealot.log \ No newline at end of file