services:
  pds:
    image: "ghcr.io/bluesky-social/pds:{{applications.bluesky.pds.version}}"
{% include 'roles/docker-compose/templates/services/base.yml.j2' %}
    volumes:
        - pds_data:/opt/pds
        - {{pdsadmin_file_path}}:/usr/local/bin/pdsadmin:ro
    ports:
      - "127.0.0.1:{{ports.localhost.http.bluesky_api}}:3000"
    healthcheck:
      test: ["CMD", "wget", "--spider", "http://127.0.0.1:3000/xrpc/_health"]
      interval: 1m
      timeout: 10s
      retries: 3
{% include 'templates/docker/container/networks.yml.j2' %}

#  Deactivated for the moment @see https://github.com/bluesky-social/social-app
  web:
    command: ["bskyweb","serve"]
    build:
      context: "{{ social_app_path }}"
      dockerfile: Dockerfile 
      # It doesn't compile yet with this parameters. @todo Fix it
      args:
        REACT_APP_PDS_URL: "https://{{domains.bluesky_api}}" # URL des PDS
        REACT_APP_API_URL: "https://{{domains.bluesky_api}}" # API-URL des PDS
        REACT_APP_SITE_NAME: "{{primary_domain | upper}} - Bluesky"
        REACT_APP_SITE_DESCRIPTION: "Decentral Social "
    ports:
      - "127.0.0.1:{{ports.localhost.http.bluesky_web}}:8100"
    healthcheck:
      test: ["CMD", "sh", "-c", "for pid in $(ls /proc | grep -E '^[0-9]+$'); do if cat /proc/$pid/cmdline 2>/dev/null | grep -q 'bskywebserve'; then exit 0; fi; done; exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3
{% include 'templates/docker/container/networks.yml.j2' %}

{% include 'templates/docker/compose/volumes.yml.j2' %}
  pds_data:

{% include 'templates/docker/compose/networks.yml.j2' %}