I have been handed the unfortunate task of attempting to maintain a Ruby on Rails version 2.3 application (with Ruby version 1.9.3). I've successfully managed to build the environment and get it running in a Docker container, but it doesn't seem to load anything in the /lib folder nor custom gems in the /vendor/gem_source folder. My understanding with Rails 2 is that it does autoload anything in both folders but I have also tried modifying the environment.rb file like so to manually import said files:
config.autoload_paths += ["#{RAILS_ROOT}/vendor"]
config.autoload_paths += ["#{RAILS_ROOT}/lib"]
This leads me to think that perhaps this is an issue with my docker configuration. Here is my Dockerfile for reference:
# Set Ruby version
FROM ruby:1.9.3-p547
RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
RUN apt-get update -qq && apt-get install -y --force-yes \
gnupg \
build-essential \
libpq-dev \
libid3-dev \
nodejs \
mysql-client \
libmysqlclient-dev
# Rails app lives here
WORKDIR /app
# Install application gems
COPY Gemfile Gemfile.lock ./
COPY vendor/gem_source /app/vendor/gem_source
COPY vendor/plugins /app/vendor/plugins
RUN gem install bundler -v 1.17.3
RUN gem install rails -v 2.3.18
RUN gem install mysql2 -v 0.4.9 -- --with-cflags="-DHAVE_RB_THREAD_BLOCKING_REGION"
RUN bundle install
# Clean up unnecessary gems
RUN bundle clean --force
# Copy application code
COPY . .
# Entrypoint prepares the database.
RUN chmod +x /app/bin/entrypoint
ENTRYPOINT ["/app/bin/entrypoint"]
# Start the server by default
EXPOSE 3000
CMD ["./script/server", "-b", "0.0.0.0"]
I never found a proper solution for this but I was able to temporarily resolve things by moving all of the "missing" files underneath the /app folder and rewriting some of the loading logic. I would still like to know if anyone has ever experienced this though and found a solution.