2
Dockerのマルチステージビルドを試して、レール生産ランタイム用のきれいな画像を作成しました。 私はインストールされた宝石を他のドッカー画像にコピーするには?
# Build image
FROM scardon/ruby-node-alpine:2.4.2 AS build-env
COPY Gemfile* ./
RUN apk update && \
apk add --no-cache --virtual build-dependencies PACKAGES && \
gem install bundler && \
bundle install && \
bundle exec assets:precompile && \
bundle exec assets:sync
# Runtime image
FROM ruby:2.4.2-alpine3.6
COPY . .
# $BUNLE_PATH is set to /usr/local/bundle in both images.
COPY --from=build-env /usr/local/bundle /usr/local/bundle
COPY --from=build-env /root/public/assets/.sprockets-manifest-abcdef123456.json /root/public/assets/.sprockets-manifest-abcdef123456.json
以下のようにしかし、下の画像でDockerfileを作った、bundle check
は、ネイティブ拡張の構築を必要とする宝石は、インストールされていないと述べています。 bundle doctor
出力は
Ignoring bindex-0.5.0 because its extensions are not built. Try: gem pristine bindex --version 0.5.0
Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-9.0.6 because its extensions are not built. Try: gem pristine byebug --version 9.0.6
Ignoring debug_inspector-0.0.3 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.3
Ignoring ffi-1.9.18 because its extensions are not built. Try: gem pristine ffi --version 1.9.18
Ignoring json-2.1.0 because its extensions are not built. Try: gem pristine json --version 2.1.0
Ignoring mysql2-0.4.8 because its extensions are not built. Try: gem pristine mysql2 --version 0.4.8
Ignoring nio4r-2.1.0 because its extensions are not built. Try: gem pristine nio4r --version 2.1.0
Ignoring nokogiri-1.8.0 because its extensions are not built. Try: gem pristine nokogiri --version 1.8.0
Ignoring oj-3.3.4 because its extensions are not built. Try: gem pristine oj --version 3.3.4
Ignoring puma-3.9.1 because its extensions are not built. Try: gem pristine puma --version 3.9.1
Ignoring rainbow-2.2.2 because its extensions are not built. Try: gem pristine rainbow --version 2.2.2
Ignoring websocket-driver-0.6.5 because its extensions are not built. Try: gem pristine websocket-driver --version 0.6.5
The latest bundler is 1.16.0.pre.3, but you are currently running 1.15.4.
To update, run `gem install bundler --pre`
The following gems are missing
* nokogiri (1.8.0)
* nio4r (2.1.0)
* websocket-driver (0.6.5)
* bindex (0.5.0)
* debug_inspector (0.0.3)
* binding_of_caller (0.7.2)
* byebug (9.0.6)
* ffi (1.9.18)
* rainbow (2.2.2)
* json (2.1.0)
* mysql2 (0.4.8)
* oj (3.3.4)
* puma (3.9.1)
Install missing gems with `bundle install`
以下のようなものです。しかし$BUNDLE_PATH
に、これらの宝石があります。 bundler
に依存関係が満たされていると言うには何が必要ですか?
は(私の下手な英語のため申し訳ありません。)あなた
ありがとう