Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dockercon Europe: Migrating Large Codebases To ...

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →

Dockercon Europe: Migrating Large Codebases To Containers

Talk given at the first European Docker Conference.

Taking a codebase not designed for docker into containers..

Avatar for Jonathan Lozinski

Jonathan Lozinski

December 04, 2014

Other Decks in Technology

Transcript

  1. FROM ruby ! ADD Gemfile /var/www/Gemfile ADD Gemfile.lock /var/www/Gemfile.lock RUN

    bundle install ! ADD . /var/www/ CMD bundle exec rails s
  2. docker run -v $(pwd):/var/www \ -v $HOME/.ssh:/root/.ssh \ my_base_ruby \

    bundle install —path=/var/www/bundle ! docker build -t myapp_base . docker run -v $(pwd):/var/www \ -v $HOME/.ssh:/root/.ssh \ my_base_ruby \ bundle install —path=/var/www/bundle ! docker build -t myapp_base . docker run -v $(pwd):/var/www \ -v $HOME/.ssh:/root/.ssh \ my_base_ruby \ bundle install —path=/var/www/bundle ! docker build -t myapp_base . docker run -v $(pwd):/var/www \ -v $HOME/.ssh:/root/.ssh \ my_base_ruby \ bundle install —path=/var/www/bundle ! docker build -t myapp_base .
  3. docker build -t $TAG . docker run --name=$TAG \ --link=runningdb:db

    \ $TAG \ sh -c ‘bundle exec rake app:prepare’ docker commit $TAG $TAG docker rm $TAG
  4. docker build -t $TAG . docker run --name=$TAG \ --link=runningdb:db

    \ $TAG \ sh -c ‘bundle exec rake app:prepare’ docker commit $TAG $TAG docker rm $TAG ! #Restore original CMD docker run -d --name=$TAG \ $TAG \ sh -c ‘bundle exec rails s’ docker commit $TAG $TAG docker rm $TAG
  5. ?