Skip to content

Instantly share code, notes, and snippets.

@benoist
Last active July 17, 2016 15:44
Show Gist options
  • Save benoist/5077f30f2477dac19d21 to your computer and use it in GitHub Desktop.
Save benoist/5077f30f2477dac19d21 to your computer and use it in GitHub Desktop.
FROM my/base
VOLUME ["/app/vendor/cache"]
ADD ./docker /app/docker
RUN if [ -f /app/docker/setup.sh ]; then /app/docker/setup.sh; fi
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install
ADD . /app
RUN PRECOMPILE=true \
SECRET_KEY_BASE=ABCDEFGHIJKLMNOPQRSTUVWXYZ01234 \
RAILS_ENV=production \
bundle exec rake assets:precompile --trace
EXPOSE 3000
ENTRYPOINT ["/app/bin/entry"]
FROM ubuntu:14.04
RUN mkdir -p /build
WORKDIR /build
ADD . /build
RUN ./install_ruby.sh
RUN ./install_default_packages.sh
RUN ./install_bundler.sh
RUN mkdir -p /bundle
RUN mkdir -p /app
WORKDIR /app
#!/bin/bash
if [ "$1" == "run_with_migration" ]; then
bundle exec rake db:create db:migrate
bundle exec rails s -b 0.0.0.0
fi
if [ "$1" == "run" ]; then
bundle exec rails s -b 0.0.0.0
fi
if [ "$1" == "sleep" ]; then
ruby -e 'while true; sleep 1; end'
fi
if [ "$1" == "be" ]; then
bundle exec "${@:2}"
fi
~/base
~/base/Dockerfile #Dockerfile-Base
~/base/install_ruby.sh
~/base/install_default_packages.sh
~/base/install_bundler.sh
~/rails_app #normal rails application
~/rails_app/bin/entry #make sure to chmod +x the entry file
~/rails_app/Dockerfile #Dockerfile-App
#!/bin/bash
echo 'gem: --no-ri --no-rdoc' > ~/.gemrc
gem install bundler -v 1.10.3
bundle config --global path /bundle
bundle config --global --jobs 4
#!/bin/bash
set -e
apt-get -y install build-essential git libpq-dev libcurl3 libcurl3-gnutls libcurl4-openssl-dev nodejs htop vim curl
#!/bin/bash
set -e
apt-get -y update
apt-get -y install python-software-properties
apt-get -y install software-properties-common
apt-add-repository -y ppa:brightbox/ruby-ng-experimental
apt-get -y update
apt-get -y install ruby2.1 ruby2.1-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment