Migrating from Rvm to Docker

@PabloVallejo

@PabloVallejo_

What is Docker?

An open platform for distributed applications 

A configurable Lightweight and Fast Virtual Machine

Use cases

Microservices

Distributed Systems

Development Environments

50% - 70%

Dockerized, Production/Development

30%

Dockerized, Development

Project setup

From: https://speakerdeck.com/asm89/docker

Usual setup

Now

Docker Toolbox

Folder structure

  docker-rails/
  ├── app/
      ├── ...
  ├── bin/
  ├── config/
  ├── db/
  ├── Dockerfile
  ├── docker-compose.yml
  ├── Gemfile
  └── config.ru

Docker setup files

db:
  image: postgres:9.5.0
  volumes:
    - .:/tmp/data/
web:
  build: .
  command: bundle exec rails s -p 3000 -b '0.0.0.0
  volumes:
    - .:/code
  ports:
    - "3000:3000"
  links:
    - db

# Django server

# Share this folder 

# Get Postgres image

docker-compose.yml

FROM ruby:2.3.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs

RUN mkdir /app
WORKDIR /app

ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock

RUN bundle install
ADD . /app

# FROM: Get image from docker index

# RUN: Run commands inside container

Dockerfile

# Build project
docker-compose build

Compose commands

# Run project
docker-compose up

Demo

PabloVallejo/docker-django

Questions

Thanks!

Rails Docker

By pablovallejo

Rails Docker

How to setup Django projects using Docker

  • 1,958