services:
  redis:
    restart: unless-stopped
    image: redis:7.0.5-alpine
    expose:
      - 6379
    ports:
      - "127.0.0.1:6379:6379"
  db:
    image: postgres
    volumes:
      - ./data/db:/var/lib/postgresql/data
    ports:
      - "127.0.0.1:5432:5432"
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
  web:
    build: .
    image: tum/network-report-image
    #command: python -X dev manage.py  runserver 0.0.0.0:8000
    #command: python manage.py  runserver 0.0.0.0:8000
    command: gunicorn kacee.wsgi:application --bind 0.0.0.0:8000 --workers=4 --timeout 1000
    #entrypoint: ./server-entrypoint.sh
    volumes:
      - ./app:/code
      - ./media:/code/media
    ports:
      - "127.0.0.1:8000:8000"
    environment:
      - POSTGRES_NAME=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - PYTHONMALLOC=debug
      - DJANGO_SETTINGS_MODULE=kacee.settings
      - MODE=${MODE}
    depends_on:
      - db
      - redis
      - rabbitmq
  worker:
    restart: unless-stopped
    #build: .
    image: tum/web-image
    #command: python -X dev manage.py  runserver 0.0.0.0:8000
    entrypoint: ./worker-entrypoint.sh
    volumes:
      - ./app:/code
      - ./media:/code/media
    environment:
      - POSTGRES_NAME=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - PYTHONMALLOC=debug
      - DJANGO_SETTINGS_MODULE=kacee.settings
      - MODE=${MODE}
    depends_on:
      - web
  websocket:
    #build: .
    image: tum/network-report-image
    command: nodemon authentication.py
    volumes:
      - ./app:/code
    ports:
      - "127.0.0.1:8888:8888"
    environment:
      - POSTGRES_NAME=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - PYTHONMALLOC=debug
      - DJANGO_SETTINGS_MODULE=kacee.settings
      - MODE=${MODE}
    depends_on:
      - db
      - redis
  rabbitmq:
    image: rabbitmq:3-management-alpine
    container_name: 'rabbitmq'
    ports:
      - "127.0.0.1:5672:5672"
      - "127.0.0.1:15672:15672"
    volumes:
        - ./rabbitmq/data/:/var/lib/rabbitmq/
        - ./rabbitmq/log/:/var/log/rabbitmq
    #networks:
        #- rabbitmq_go_net
