- 
      
 - 
        
Save stympy/6beab49c22d2ffa21749e56d91ae1bad to your computer and use it in GitHub Desktop.  
    Docker dev environment for Ruby on Rails
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | version: '3.2' | |
| services: | |
| postgres: | |
| image: postgres | |
| web: | |
| build: . | |
| volumes: | |
| - type: bind | |
| source: . | |
| target: /app | |
| ports: | |
| - "3000:3000" | |
| depends_on: | |
| - postgres | |
| command: | |
| - ./run.sh | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Ruby on Rails Development Environment | |
| FROM ruby:2.5.0 | |
| # Set up Linux | |
| RUN apt-get update | |
| RUN apt-get install -y build-essential inotify-tools libpq-dev nodejs postgresql-client | |
| WORKDIR /app | |
| EXPOSE 3000 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/sh | |
| set -e | |
| # Ensure the app's dependencies are installed | |
| bundle install --without=production | |
| # Wait for Postgres to become available. | |
| echo "Waiting for Postgres..." | |
| until psql -h postgres -U "postgres" -c '\q' 2>/dev/null; do | |
| sleep 1 | |
| done | |
| # Potentially Set up the database | |
| bin/rails db:setup | |
| # Start the web server | |
| bin/rails s -p 3000 -b '0.0.0.0' | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment