version: '2'

volumes:
  postgres_data_dev: {}
  postgres_backup_dev: {}

services:
  postgres:
    build: ./compose/postgres
    volumes:
      - postgres_data_dev:/var/lib/postgresql/data
      - postgres_backup_dev:/backups
    env_file: .env

  django:
    build:
      context: .
      dockerfile: ./compose/django/Dockerfile-dev
    command: /start-dev.sh
    depends_on:
      - postgres
    env_file: .env
    volumes:
      - .:/app
    ports:
      - "8180:8000"
    links:
      - postgres
      - mailhog

  mailhog:
    image: mailhog/mailhog
    ports:
      - "8125:8025"

  redis:
    image: redis:latest

  celeryworker:
    build:
      context: .
      dockerfile: ./compose/django/Dockerfile-dev
    env_file: .env
    volumes:
      - .:/app
    depends_on:
      - postgres
      - redis
    command: celery -A mhackspace.celeryapp worker -l INFO

  celerybeat:
    build:
      context: .
      dockerfile: ./compose/django/Dockerfile-dev
    env_file: .env
    volumes:
      - .:/app
    depends_on:
      - postgres
      - redis
    command: celery -A mhackspace.celeryapp beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler

  bucket:
    image: minio/minio
    env_file: .env
    volumes:
      - ./mhackspace:/data
    command: server /data
