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:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user