version: "3.8"
services:
  redis:
    image: redis:latest
    container_name: dj_sms_redis
    command: redis-server
    ports:
    - '6379:6379'
    networks:
      django_school_network:
  postgres_db:
    image: postgres:latest
    container_name: django_school_pgsql
    volumes:
      - /d/dockerdata/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=django-school-1
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    ports:
      - '5432:5432'
    networks:
      django_school_network:
  django:
    build: .
    container_name: dj_sms_server
    image: dj_sms_docker
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
      - static:/code/static
      - media:/code/media
    ports:
      - "8000:8000"
    links:
      - redis
      - postgres_db
    depends_on:
      - postgres_db
    networks:
      django_school_network:
  celery:
    build: .
    command: celery -A config worker -l INFO
    volumes:
      - .:/code
    links:
      - redis
      - django
    depends_on:
      - django
    networks:
      django_school_network:

volumes:
  media:
  static:

networks:
  django_school_network:
    driver: bridge