name: HospitalAssistantAPI

x-app-common: &app-common
  build:
    context: .
    target: production
  tty: true
  restart: unless-stopped
  stop_signal: SIGINT
  env_file:
    - .env
  environment:
    DATABASE_URL: "postgresql://postgres:example@db:5432/postgres"
    REDIS_URL: "redis://valkey:6379/0"
  volumes:
    - "./container/certt.cer:/var/opt/cprocsp/keys/cert.cer"
    - "./container/cont:/app/cont"

services:
  valkey:
    image: valkey/valkey:alpine
    restart: unless-stopped
    ports:
      - ${VALKEY_PORT:-6380}:6379
    healthcheck:
      test: [ "CMD", "redis-cli", "ping" ]
      interval: 5s
      timeout: 10s
      retries: 5

  web:
    <<: *app-common
    ports:
      - "${APP_PORT:-6767}:${APP_PORT:-6767}"
