Ctrl K
ComunidadGuías…

docker-compose.test.yml

Rama master · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# vim: ft=yaml.docker-compose

services:
  anthias-test:
    # Both anthias-test and anthias-celery declare the same image tag
    # AND the same build block. Compose deduplicates the build by
    # image tag, so the image is produced once; ghcr layer cache
    # (configured by ``tools.image_builder`` via the Dockerfile's
    # ``# syntax`` line + ``--mount=type=cache`` and the buildx
    # invocation in ci) is hit by both service builds. Sharing the
    # ``build:`` block also keeps either service from triggering a
    # registry pull for the local-only ``anthias-test:dev`` tag.
    image: anthias-test:dev
    build: &test_build
      context: .
      dockerfile: docker/Dockerfile.test
    # Shared with anthias-celery via the anchor: the worker MUST see
    # the same ENVIRONMENT/ANTHIAS_TEST_DB_PATH as the server. Without
    # ENVIRONMENT=test, settings.py takes the production branch on the
    # worker — it reads the (empty) /data/.anthias/anthias.db instead
    # of the test DB ("no such table: assets" on every task) and, with
    # no DSN override, ships those errors to the production Sentry
    # project tagged environment=production.
    environment: &test_env
      - HOME=/data
      - CELERY_BROKER_URL=redis://redis:6379/0
      - CELERY_RESULT_BACKEND=redis://redis:6379/0
      - ENVIRONMENT=test
      # Pin the test DB to the writable volume mount on /data so CI
      # keeps its historic location. Local runs (no override) fall back
      # to a repo-local path inside BASE_DIR — see
      # src/anthias_server/django_project/settings.py.
      - ANTHIAS_TEST_DB_PATH=/data/.anthias/test.db
    stdin_open: true
    tty: true
    volumes:
      - .:/usr/src/app
      - anthias-data:/data

  anthias-celery:
    # Same image as anthias-test (test image is a superset of server:
    # same base apt + venv + bun + chromium for playwright); only the CMD
    # differs. Sharing the ``build:`` anchor lets compose route this
    # service through the ghcr layer cache too instead of attempting
    # a Docker Hub pull on the local-only ``anthias-test:dev`` tag.
    image: anthias-test:dev
    build: *test_build
    command: >
      celery -A anthias_server.celery_tasks.celery worker -B -n worker@anthias
      --loglevel=info --scheduler celery.beat.Scheduler
    depends_on:
      anthias-test:
        condition: service_started
      redis:
        condition: service_healthy
    environment: *test_env
    restart: always
    volumes:
      - .:/usr/src/app
      - anthias-data:/data

  redis:
    image: mirror.gcr.io/library/redis:alpine
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 3s
      retries: 12
      start_period: 10s

volumes:
  anthias-data:
  redis-data: