Skip to content

Instantly share code, notes, and snippets.

@stympy
Forked from dogweather/Dockerfile
Last active February 3, 2018 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stympy/6beab49c22d2ffa21749e56d91ae1bad to your computer and use it in GitHub Desktop.
Save stympy/6beab49c22d2ffa21749e56d91ae1bad to your computer and use it in GitHub Desktop.
Docker dev environment for Ruby on Rails
version: '3.2'
services:
postgres:
image: postgres
web:
build: .
volumes:
- type: bind
source: .
target: /app
ports:
- "3000:3000"
depends_on:
- postgres
command:
- ./run.sh
# 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
#!/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