Skip to content

Instantly share code, notes, and snippets.

@gs
Created July 11, 2025 11:19
Show Gist options
  • Save gs/e5f65923a2cd15da65426a2754e64fad to your computer and use it in GitHub Desktop.
Save gs/e5f65923a2cd15da65426a2754e64fad to your computer and use it in GitHub Desktop.
Docker - Rails 2.3.X
FROM ubuntu:16.04
# Install system dependencies including an older GCC for Ruby 1.8.7 builds
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
gnupg \
build-essential \
libssl-dev \
libreadline-dev \
zlib1g-dev \
libsqlite3-dev \
gcc-4.8 \
g++-4.8 \
&& rm -rf /var/lib/apt/lists/*
# Force use of gcc-4.8 and g++-4.8
ENV CC=gcc-4.8
ENV CXX=g++-4.8
# Import RVM GPG keys
RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
# Install RVM (Ruby Version Manager)
RUN curl -sSL https://get.rvm.io | bash -s stable
# Ensure that RVM is sourced in every login shell
RUN echo "source /usr/local/rvm/scripts/rvm" >> /etc/profile.d/rvm.sh
# Install Ruby Enterprise Edition (REE 1.8.7-2012.02) using RVM.
RUN /bin/bash -l -c "rvm install ree-1.8.7-2012.02 --verify-downloads 1"
RUN /bin/bash -l -c "rvm use ree-1.8.7-2012.02 --default"
# Update PATH to include RVM's Ruby and gem directories
ENV PATH="/usr/local/rvm/rubies/ree-1.8.7-2012.02/bin:/usr/local/rvm/gems/ree-1.8.7-2012.02/bin:/usr/local/rvm/bin:${PATH}"
RUN /bin/bash -l -c "gem install rake -v 0.8.7 --no-ri --no-rdoc"
RUN /bin/bash -l -c "gem install rails -v 2.3.10 --no-ri --no-rdoc"
RUN /bin/bash -l -c "gem install sqlite3 -v 1.3.11 --no-ri --no-rdoc"
RUN /bin/bash -l -c "gem install rubygems-update -v 1.8.30 --no-ri --no-rdoc"
RUN /bin/bash -l -c "gem update --system 1.8.30"
# Set the working directory for your app
WORKDIR /app
# Copy your application code into the container
COPY . /app
# (Optional) Declare a volume for the database directory if you're using an external SQLite DB
VOLUME ["/app/db"]
EXPOSE 3000
# Default command: start the Rails server.
CMD ["/bin/bash", "-l", "-c", "./script/server -b 0.0.0.0 -e production"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment