version: "3.7"

x-openedx-service:
  &openedx-service
  image: {{ DOCKER_IMAGE_OPENEDX_DEV }}
  environment:
    SETTINGS: ${TUTOR_EDX_PLATFORM_SETTINGS:-tutor.development}
  volumes:
    # Settings & config
    - ../apps/openedx/settings/lms/:/openedx/edx-platform/lms/envs/tutor/
    - ../apps/openedx/settings/cms/:/openedx/edx-platform/cms/envs/tutor/
    - ../apps/openedx/config/:/openedx/config/
    # theme files
    - ../build/openedx/themes:/openedx/themes
    # editable requirements
    - ../build/openedx/requirements:/openedx/requirements

services:
  lms:
    <<: *openedx-service
    command: ./manage.py lms runserver 0.0.0.0:8000
    ports:
        - "8000:8000"
    networks:
      default:
        aliases:
          - "{{ LMS_HOST }}"

  cms:
    <<: *openedx-service
    command: ./manage.py cms runserver 0.0.0.0:8000
    ports:
        - "8001:8000"

  lms-worker:
    <<: *openedx-service

  cms-worker:
    <<: *openedx-service
  
  # Additional service for watching theme changes
  watchthemes:
    <<: *openedx-service
    command: openedx-assets watch-themes --env dev
    restart: unless-stopped

  {{ patch("local-docker-compose-dev-services")|indent(2) }}