Skip to content

Commit

Permalink
feat: ruby 升级 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
icyleaf committed Oct 20, 2020
1 parent 41c08d9 commit 6991df1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
17 changes: 8 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.6-alpine as builder
FROM ruby:2.7-alpine as builder

ARG BUILD_PACKAGES="build-base libxml2 libxslt git"
ARG DEV_PACKAGES="libxml2-dev libxslt-dev yaml-dev imagemagick-dev postgresql-dev nodejs npm yarn"
Expand Down Expand Up @@ -39,6 +39,7 @@ RUN yarn install
# Ruby dependencies
COPY Gemfile Gemfile.lock ./
RUN bundle config --global frozen 1 && \
bundle config set deployment 'true' && \
bundle config set without 'development test' && \
bundle install --path=vendor/bundle \
--jobs `expr $(cat /proc/cpuinfo | grep -c "cpu cores") - 1` --retry 3
Expand All @@ -49,11 +50,15 @@ RUN SECRET_TOKEN=precompile_placeholder bin/rails assets:precompile && \

# Remove folders not needed in resulting image
RUN rm -rf docker node_modules tmp/cache spec .browserslistrc babel.config.js \
package.json postcss.config.js yarn.lock
package.json postcss.config.js yarn.lock && \
cd /app/vendor/bundle/ruby/2.7.0 && \
rm -rf cache/*.gem && \
find gems/ -name "*.c" -delete && \
find gems/ -name "*.o" -delete

##################################################################################

FROM ruby:2.6-alpine
FROM ruby:2.7-alpine

ARG BUILD_DATE
ARG VCS_REF
Expand Down Expand Up @@ -103,12 +108,6 @@ WORKDIR $APP_ROOT
COPY docker/rootfs /
COPY --from=builder $APP_ROOT $APP_ROOT

# Remove unnecessary files
RUN cd /app/vendor/bundle/ruby/2.6.0 && \
rm -rf cache/*.gem && \
find gems/ -name "*.c" -delete && \
find gems/ -name "*.o" -delete

EXPOSE 3000

ENTRYPOINT ["/init"]
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -530,4 +530,4 @@ RUBY VERSION
ruby 2.6.5p114

BUNDLED WITH
2.1.2
2.1.4
4 changes: 4 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class Application < Rails::Application
config.i18n.default_locale = locale.to_sym
config.i18n.available_locales = [locale, :en]

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = [I18n.default_locale]

# Log to STDOUT because Docker expects all processes to log here. You could
# the framework and any gems in your application.
# or a third party host such as Loggly, etc..
Expand Down
4 changes: 0 additions & 4 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@
# config.action_mailer.default_url_options = { host: Setting.site_domain }


# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = [I18n.default_locale]

# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify

Expand Down

0 comments on commit 6991df1

Please sign in to comment.