x-backend: &backend image: cofee-backend:dev build: context: . dockerfile: Dockerfile target: prod env_file: - .env restart: unless-stopped volumes: - ~/srv/storage/cofee_backend_api/.certs:/app/.certs:ro - ~/srv/storage/cofee_backend_api/.artifacts:/app/.artifacts networks: - services_local services: api: <<: *backend container_name: cofee_backend_api labels: - "traefik.enable=true" - "traefik.docker.network=proxy" - "traefik.http.routers.cofee-backend.rule=Host(`api.trimgu.ru`)" - "traefik.http.routers.cofee-backend.entrypoints=websecure" - "traefik.http.routers.cofee-backend.service=cofee-backend" - "traefik.http.services.cofee-backend.loadbalancer.server.port=8000" networks: - services_local - proxy healthcheck: test: [ "CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health/')", ] interval: 30s timeout: 5s retries: 3 start_period: 30s worker: <<: *backend container_name: cofee_backend_worker command: [ "dramatiq", "cpv3.modules.tasks.service", "--processes", "1", "--threads", "2", ] healthcheck: test: [ "CMD-SHELL", "pgrep -f dramatiq || exit 1" ] interval: 30s timeout: 5s retries: 3 start_period: 30s networks: services_local: external: true proxy: external: true