Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Set docker-compose version
version: '3'
services:
postgres:
container_name: postgres
ports:
- "5432:5432"
volumes:
- $HOME/postgres-data:/var/lib/postgresql
image: postgres:9.6.9
elasticsearch:
container_name: elasticsearch
ports:
- "9200:9200"
volumes:
- $HOME/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- $HOME/elasticsearch/data:/usr/share/elasticsearch/data
links:
- postgres
image: elasticsearch:5.2.1
redis:
container_name: redis
ports:
- "6379:6379"
links:
- postgres
image: redis:5.0-rc
web:
container_name: web
build: .
ports:
- "3000:3000"
command: /bin/sh -c "rails s -b 0.0.0.0 -p 3000"
volumes:
- .:/app
depends_on:
- postgres
- redis
- elasticsearch
# Environment variables that allow my app to find other services
environment:
REDISTOGO_URL: "redis://redis:6379"
POSTGRES_USER: postgres
POSTGRES_HOST: postgres
ELASTICSEARCH_URL: "http://elasticsearch:9200"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment