version: "3.7"

services:
  web:
    build:
      context: .
      dockerfile: .docker/ruby/Dockerfile
    command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
    depends_on:
      - postgres
      - redis
    environment:
      - SPROCKETS_CACHE=/cache
    volumes:
      - ./:/app
      - cache:/cache
    ports:
      - 3000:3000

  redis:
    image: redis:3.2.11-alpine
    ports: 
      - 6379:6379

  postgres:
    image: postgres:10.12
    ports:
      - 5432:5432
    environment:
      POSTGRES_PASSWORD: justask
      POSTGRES_DB: justask_development

volumes:
  cache:
version: "3.7"

services:
  web:
    build:
      context: .
      dockerfile: .docker/ruby/Dockerfile
    command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
    depends_on:
      - postgres
      - redis
    environment:
      - SPROCKETS_CACHE=/cache
    volumes:
      - ./:/app
      - cache:/cache
    ports:
      - 3000:3000

  redis:
    image: redis:3.2.11-alpine
    ports: 
      - 6379:6379

  postgres:
    image: postgres:10.12
    ports:
      - 5432:5432
    environment:
      POSTGRES_PASSWORD: justask
      POSTGRES_DB: justask_development
    volumes:
      - db:/var/lib/postgresql/data

volumes:
  db:
  cache:
Store Postgres data in volume
Store Postgres data in volume
