version: '3.9'

services:
  job:
    image: {{ job_image }}
    command: ["python", "-m", "btrixcloud.swarm.profile_job"]

    volumes:
      - {{ env.SOCKET_SRC | default("/var/run/docker.sock", true) }}:{{ env.SOCKET_DEST | default("/var/run/docker.sock", true) }}:z

    networks:
      - btrix

    deploy:
      labels:
        btrix.profile: "1"
        btrix.archive: {{ aid }}
        btrix.user: {{ userid }}
        {%- if baseprofile %}
        btrix.baseprofile: "{{ baseprofile }}"
        {%- endif %}

      #mode: replicated-job
      replicas: 1

    environment:
      JOB_ID: "{{ id }}"
      STACK_PREFIX: "browser-"

      CRAWLER_IMAGE: "{{ env.CRAWLER_IMAGE }}"

      STORE_ENDPOINT_URL: "{{ env.STORE_ENDPOINT_URL }}"
      STORE_ACCESS_KEY: "{{ env.STORE_ACCESS_KEY }}"
      STORE_SECRET_KEY: "{{ env.STORE_SECRET_KEY }}"

      STORE_PATH: "{{ storage_path }}"
      STORAGE_NAME: "{{ storage_name }}"
      IDLE_TIMEOUT: "60"
      START_URL: "{{ url }}"
      PROFILE_PATH: "{{ profile_path }}"
 
networks:
  btrix:
    external: 
      name: btrix-net

