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:
      - "5432:5432"
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
  web:
    build: .
    command: >
     sh -c "python manage.py migrate &&
            python manage.py runserver 0.0.0.0:8000"
    #entrypoint: ./server-entrypoint.sh
    tty: true
    volumes:
      - ./app:/code
      - ./media:/code/media
    ports:
      - "127.0.0.1:8020:8000"
    environment:
      - POSTGRES_NAME=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - PYTHONMALLOC=debug
      - DJANGO_SETTINGS_MODULE=tmt_learning.settings
    depends_on:
      - db
      - redis
      #- rabbitmq

  tailwind:
    build: .
    #image: web
    command: npm run watch
    tty: true
    volumes:
      - ./app:/code

  websocket:
    build: .
    #image: web
    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=tmt_learning.settings
    depends_on:
      - db
      - redis
