version: '3'
services:
  db:
    image: postgres
    volumes:
      - stafflist_db:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: stafflist_db_password
  redis:
    image: 'redis:5-alpine'
    command: redis-server
    ports:
      - '6379:6379'
    volumes:
      - stafflist_redis:/data
  app:
    build:
      context: .
      dockerfile: docker/Dockerfile
    volumes:
      - .:/app
      - /app/node_modules/
      - /app/tmp/
    environment:
      RAILS_ENV: ${RAILS_ENV:-development}
      REDIS_URL: ${REDIS_URL:-redis://redis:6379/1}
      RAILS_SERVE_STATIC_FILES: ${RAILS_SERVE_STATIC_FILES:-true}
      RAILS_LOG_TO_STDOUT: ${RAILS_LOG_TO_STDOUT:-true}
    ports:
      - "3000:3000"
    depends_on:
      - db
      - redis
    stdin_open: true
    tty: true
volumes:
  stafflist_db:
  stafflist_redis:
