Code Monkey home page Code Monkey logo

docker-hub-rails-postgresql's Introduction

Dockerize Rails for development

Ruby 2.3.1, bundle, node 8.9.1, postgresql-client.

Image with default lib for rails 5.1.4

This image not execute bundle install, you need to run bundle install after run the container

Using docker-compose

version: '3'
services:
  web:
    image: miguelsavignano/rails_5.1.4_postgresql
    container_name: web
    stdin_open: true
    tty: true
    command: "bash ./web_start.sh"
    volumes:
      - .:/myapp
      - ./volumes/bundle:/usr/local/bundle
    ports:
      - "3000:3000"
    depends_on:
      - db
    network_mode: host
  db:
    image: postgres:9.5.9
    ports:
      - "5432:5432"
    volumes:
      - ./volumes/postgresql:/var/lib/postgresql/data

database.yml

....
  adapter: postgresql
  encoding: unicode
  host: 127.0.0.1
  username: postgres
  password:
....

Use custom start script

create file web_start.sh with

bundle install
npm install
rm -f tmp/pids/server.pid
bundle exec rails server -p 3000 -b 0.0.0.0

Notes

Execute container bash terminal

use rails console, rails generators, or rake

docker exec -it web bash

Debugger Rails with bybug or pry

  • you need to attach the in the container. important: if you close the terminal with CTRL + C you stop the container
docker attach web

docker-hub-rails-postgresql's People

Contributors

miguelsavignano avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.