{% set runtime = runtime | default('python') %}
{% set include_postgres = include_postgres | default(true) %}
{% set package_manager_command = package_manager_command | default(package_manager | default('npm')) %}
services:
  app:
    profiles:
      - local
    build:
      context: .
      dockerfile: Dockerfile
    command: >-
{% if runtime == 'python' %}
      poetry run uvicorn src.main:app --reload --host 0.0.0.0 --port 8000
{% else %}
      {{ package_manager_command }} run start:dev
{% endif %}
    ports:
{% if runtime == 'python' %}
      - "8000:8000"
{% else %}
      - "3000:3000"
{% endif %}
    volumes:
      - .:/app
    environment:
      APP_ENV: local
{% if include_postgres %}
    depends_on:
      - postgres
{% endif %}
{% if include_postgres %}
  postgres:
    profiles:
      - local
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 10s
{% endif %}
