Error loading shared library libsqlite3.so.0 in Docker container

I’m getting the following stack trace when I try to build a Rails application in a Docker container from Alpine Ruby 2.6.3.

I’ve tried installing sqlite, sqlite-dev, and sqlite-libs, since there is no apk package for “libsqlite3”.

Am I going about this the wrong way?

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)>'

And here is my 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

Source: StackOverflow