Я получаю следующую трассировку стека, когда пытаюсь построить приложение Rails в контейнере Docker из Alpine Ruby 2.6.3.
Я пытался установить sqlite
, sqlite-dev
иsqlite-libs
, поскольку не существует пакета apk
для "libsqlite3".
Я поступаю неправильно?
LoadError: Error loading shared library libsqlite3.so.0: No such file or directory (needed by /usr/local/bundle/gems/sqlite3-1.3.13/lib/sqlite3/sqlite3_native.so) - /usr/local/bundle/gems/sqlite3-1.3.13/lib/sqlite3/sqlite3_native.so
/usr/local/bundle/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:293:in `require'
/usr/local/bundle/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:293:in `block in require'
/usr/local/bundle/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:259:in `load_dependency'
/usr/local/bundle/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:293:in `require'
/usr/local/bundle/gems/sqlite3-1.3.13/lib/sqlite3.rb:6:in `rescue in <top (required)>'
/usr/local/bundle/gems/sqlite3-1.3.13/lib/sqlite3.rb:2:in `<top (required)>'
/app/config/application.rb:7:in `<top (required)>'
А вот мой файл Dockerfile:
FROM ruby:2.6.4-alpine3.9
WORKDIR /app
ENV RAILS_ENV=production
ENV RAILS_SERVE_STATIC_FILES=true
EXPOSE 3000
####
# Setup ruby environment
####
COPY ./admin/Gemfile* ./admin/*.gemspec ./admin/
COPY ./admin/lib/admin/version.rb ./admin/lib/admin/
RUN apk add --no-cache --virtual=.build-deps \
git openssh-client build-base mariadb-dev sqlite-libs sqlite-dev sqlite \
#Installing bundler without versioning could break things.
&& gem install bundler --pre \
&& bundle install --without=development,test \
&& bundle config \
&& apk del .build-deps
COPY . ./
RUN bundle config && bundle \
&& rm -f config/database.yml \
&& DATABASE_URL=sqlite3:/tmp/assets_dummy.sqlite3 bundle exec rake assets:precompile
COPY entrypoint /usr/local/bin/entrypoint