version: '3.9'

services:
  client:
    image: "{{ client_image }}"
    env_file:
      - "{{ config_dir }}/.env.local"
    labels:
      traefik.enable: true
      traefik.http.routers.{{ project_name }}-client.rule: '( Host(`{{ web_domain }}`) || Host(`{{ project_domain }}`) )'
      traefik.http.routers.{{ project_name }}-client.entryPoints: https
      traefik.http.routers.{{ project_name }}-client.tls: true 

    networks:
      - http
    restart: always

  server:
    image: "{{ server_image }}"
    env_file:
      - "{{ config_dir }}/.env"
    environment:
      PORT: 3001
      CHECK_STATUS_ID: "{{ web_status_id }}"

    expose:
      - 3001
    labels:
      traefik.enable: true
      traefik.http.routers.{{ project_name }}-server.rule: '( Host(`{{ web_domain }}`) || Host(`{{ project_domain }}`) ) && ( PathPrefix(`/api`) || PathPrefix(`/app`) )'
      traefik.http.routers.{{ project_name }}-server.entryPoints: https
      traefik.http.routers.{{ project_name }}-server.tls: true
    networks:
      - http
    restart: always

networks:
  http:
    external: true
    name: traefik_http
