{% include 'roles/docker-compose/templates/base.yml.j2' %}

  pds:
{% set container_port = 3000 %}
{% set container_healthcheck = 'xrpc/_health' %}
    image: "{{ BLUESKY_PDS_IMAGE }}:{{ BLUESKY_PDS_VERSION }}"
{% include 'roles/docker-container/templates/base.yml.j2' %}
    volumes:
        - pds_data:{{ BLUESKY_PDS_DATA_DIR }}
        - {{ BLUESKY_PDSADMIN_FILE }}:/usr/local/bin/pdsadmin:ro
    ports:
      - "127.0.0.1:{{ BLUESKY_API_PORT }}:{{ container_port }}"

{% include 'roles/docker-container/templates/healthcheck/wget.yml.j2' %}
{% include 'roles/docker-container/templates/networks.yml.j2' %}

{% if BLUESKY_WEB_ENABLED %}
{% set container_port = 8100 %}
  web:
    command: ["bskyweb","serve"]
    build:
      context: "{{ BLUESKY_SOCIAL_APP_DIR }}"
      dockerfile: Dockerfile
    pull_policy: never
    ports:
      - "127.0.0.1:{{ BLUESKY_WEB_PORT }}:{{ container_port }}"
{% include 'roles/docker-container/templates/healthcheck/tcp.yml.j2' %}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
{% endif %}

{% include 'roles/docker-compose/templates/volumes.yml.j2' %}
  pds_data:
    name: {{ BLUESKY_PDS_DATA_VOLUME }}
{% include 'roles/docker-compose/templates/networks.yml.j2' %}