fix: dialogflow integration in docker environments (#3072)

* natively compile ruby gems

* add missing compiler tools

* add bundler platform ruby to force native compilation

* fix bundler env in final docker stage

* add comments to DockerFile

Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
Vishnu Narayanan 2021-09-28 20:49:50 +05:30 committed by GitHub
parent ed22e7cad4
commit 6129edce08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View file

@ -247,6 +247,7 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
google-protobuf (3.17.3)
google-protobuf (3.17.3-universal-darwin)
google-protobuf (3.17.3-x86_64-linux)
googleapis-common-protos (1.3.11)
@ -264,6 +265,9 @@ GEM
signet (~> 0.14)
groupdate (5.2.2)
activesupport (>= 5)
grpc (1.38.0)
google-protobuf (~> 3.15)
googleapis-common-protos-types (~> 1.0)
grpc (1.38.0-universal-darwin)
google-protobuf (~> 3.15)
googleapis-common-protos-types (~> 1.0)
@ -346,6 +350,7 @@ GEM
mime-types-data (3.2021.0704)
mini_magick (4.11.0)
mini_mime (1.1.1)
mini_portile2 (2.5.3)
minitest (5.14.4)
mock_redis (0.28.0)
ruby2_keywords
@ -360,6 +365,9 @@ GEM
netrc (0.11.0)
newrelic_rpm (7.2.0)
nio4r (2.5.8)
nokogiri (1.11.7)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
nokogiri (1.11.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.11.7-x86_64-darwin)
@ -617,6 +625,7 @@ GEM
PLATFORMS
arm64-darwin-20
ruby
x86_64-darwin-18
x86_64-darwin-20
x86_64-darwin-21

View file

@ -33,6 +33,11 @@ WORKDIR /app
COPY Gemfile Gemfile.lock ./
# natively compile grpc and protobuf to support alpine musl (dialogflow-docker workflow)
# https://github.com/googleapis/google-cloud-ruby/issues/13306
RUN apk add --no-cache musl ruby-full ruby-dev gcc make musl-dev openssl openssl-dev g++ linux-headers
RUN bundle config set --local force_ruby_platform true
# Do not install development or test gems in production
RUN if [ "$RAILS_ENV" = "production" ]; then \
bundle config set without 'development test'; bundle install -j 4 -r 3; \
@ -71,6 +76,9 @@ ENV EXECJS_RUNTIME ${EXECJS_RUNTIME}
ARG RAILS_SERVE_STATIC_FILES=true
ENV RAILS_SERVE_STATIC_FILES ${RAILS_SERVE_STATIC_FILES}
ARG BUNDLE_FORCE_RUBY_PLATFORM=1
ENV BUNDLE_FORCE_RUBY_PLATFORM ${BUNDLE_FORCE_RUBY_PLATFORM}
ARG RAILS_ENV=production
ENV RAILS_ENV ${RAILS_ENV}
ENV BUNDLE_PATH="/gems"

View file

@ -20,6 +20,7 @@ done
echo "Database ready to accept connections."
#install missing gems for local dev as we are using base image compiled for production
bundle install
BUNDLE="bundle check"