version: '3'

services:
  postgres:
    image: postgres:9.3
    environment:
      - POSTGRES_PASSWORD=mysecretpassword
      - POSTGRES_USER=parsley
    volumes:
      - sql-data:/var/lib/postgresql/data

  memcache:
      image: memcached:1.5.4-alpine
      command: memcached -m 512

  web:
    build: .
    image: registry.elbert.us/parsley:latest
    command: web
    ports:
      - "3000:80"
    links:
      - app

  app:
    build: .
    image: registry.elbert.us/parsley:latest
    command: app
    environment:
      - PORT=80
      - RAILS_USE_MEMCACHE=true
      - RAILS_LOG_TO_STDOUT=true
    links:
      - postgres
      - memcache

volumes:
  sql-data:
    driver: local