services:
  web:
    build: .
    dns:
      - 8.8.8.8
      - 1.1.1.1
    restart: unless-stopped
    entrypoint: ["sh", "/app/docker/entrypoint.sh"]
    command: daphne -b 0.0.0.0 -p 8004 coresite.asgi:application
    ports:
      - "127.0.0.1:8004:8004"
    env_file:
      - .env
    environment:
      RUN_MIGRATIONS: "1"
      RUN_COLLECTSTATIC: "1"
      REDIS_HOST: redis
      REDIS_PORT: "6379"
      PYTHONPATH: /app/server
      RUN_CACHE_WARMUP: "1"
      CELERY_BROKER_URL: redis://redis:6379/0
      CELERY_RESULT_BACKEND: redis://redis:6379/0
    depends_on:
      - redis

  worker:
    build: .
    dns:
      - 8.8.8.8
      - 1.1.1.1
    restart: unless-stopped
    entrypoint: ["sh", "/app/docker/entrypoint.sh"]
    command: celery -A coresite worker -l info
    env_file:
      - .env
    environment:
      RUN_MIGRATIONS: "0"
      RUN_COLLECTSTATIC: "0"
      REDIS_HOST: redis
      REDIS_PORT: "6379"
      PYTHONPATH: /app/server
      CELERY_BROKER_URL: redis://redis:6379/0
      CELERY_RESULT_BACKEND: redis://redis:6379/0
    depends_on:
      - redis

  beat:
    build: .
    dns:
      - 8.8.8.8
      - 1.1.1.1
    restart: unless-stopped
    entrypoint: ["sh", "/app/docker/entrypoint.sh"]
    command: celery -A coresite beat -l info
    env_file:
      - .env
    environment:
      RUN_MIGRATIONS: "0"
      RUN_COLLECTSTATIC: "0"
      REDIS_HOST: redis
      REDIS_PORT: "6379"
      PYTHONPATH: /app/server
      CELERY_BROKER_URL: redis://redis:6379/0
      CELERY_RESULT_BACKEND: redis://redis:6379/0
    depends_on:
      - redis

  redis:
    image: redis:7-alpine
    restart: unless-stopped
    volumes:
      - redis_data:/data

volumes:
  redis_data:
