version: "3.11"

services:
  web:
    build: .
    restart: always
    command: ${COMMAND:-python3 manage.py runserver 0.0.0.0:8000}
    volumes:
      - .:/code
    ports:
      - "8001:8000"
    depends_on:
      - db
      - redis
  db:
    image: postgres:13
    restart: always
    environment:
      POSTGRES_DB: django
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 2309
    volumes:
      - pg_data:/var/lib/postgresql/data
  redis:
    restart: always
    image: "redis"
  ngrok:
    image: ngrok/ngrok:latest
    ports:
      - ${NGROK_ADMIN_PORT}:4040
    environment:
      NGROK_AUTHTOKEN: ${NGROK_AUTHTOKEN}
    command: http http://web:8000 --domain=${NGROK_DOMAIN}
  nginx:
    build: ./nginx
    ports:
      - '81:80'
    depends_on:
      - web

#  vite:
#    build:
#      context: .
#      dockerfile: ViteDockerfile
#    ports:
#      - ${VITE_PORT}:5173
#    volumes:
#      - .:/code
#      - /code/node_modules

  celery:
   build: .
   command: celery -A config worker --loglevel=info
   restart: always
   volumes:
     - .:/code
   depends_on:
     - web
     - redis

#  celery-beat:
#    build: .
#    command: celery -A config beat --loglevel=info
#    restart: always
#    volumes:
#      - .:/code
#    depends_on:
#      - web
#      - redis

volumes:
  pg_data:

