Skip to content

Commit

Permalink
fix: 解决 bootstrap 在 docker 无法引用的问题 (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
icyleaf committed Jul 24, 2020
1 parent 491103a commit 3d9b87d
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 18 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Expand Up @@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -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
# 调试控制台
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Expand Up @@ -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)
Expand Down Expand Up @@ -462,7 +462,7 @@ DEPENDENCIES
awesome_print
better_errors
binding_of_caller
bootsnap (>= 1.4.4)
bootsnap (>= 1.4.7)
byebug
carrierwave
debase
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Expand Up @@ -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
9 changes: 3 additions & 6 deletions 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.
6 changes: 1 addition & 5 deletions config/webpacker.yml
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker/rootfs/etc/cont-init.d/20-init-zealot
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions 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

0 comments on commit 3d9b87d

Please sign in to comment.