services:
  backend:
    image: git.az-it.net/az/morz-infoboard/backend:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:8080"
    env_file:
      - .env
    environment:
      MORZ_INFOBOARD_HTTP_ADDR: ":8080"
      MORZ_INFOBOARD_DATABASE_URL: "postgres://morz_infoboard:${POSTGRES_PASSWORD}@db:5432/morz_infoboard?sslmode=disable"
      MORZ_INFOBOARD_UPLOAD_DIR: /app/uploads
      MORZ_INFOBOARD_STATUS_STORE_PATH: /app/data/status
      MORZ_INFOBOARD_DEV_MODE: "false"
      TZ: "Europe/Berlin"
    volumes:
      - ./uploads:/app/uploads
      - ./data:/app/data
    depends_on:
      db:
        condition: service_healthy
    networks:
      - internal
      - proxy

  db:
    image: postgres:17-alpine
    restart: unless-stopped
    env_file:
      - .env
    environment:
      POSTGRES_USER: morz_infoboard
      POSTGRES_DB: morz_infoboard
    volumes:
      - ./data/db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U morz_infoboard"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - internal


networks:
  internal:
  proxy:
    # Gemeinsames Netz mit dem Reverse Proxy (z. B. Traefik/Nginx Proxy Manager).
    # Falls der Proxy ein eigenes externes Netz verwaltet, hier name: und external: true setzen.
    # Beispiel:
    #   name: proxy
    #   external: true
