version: "3.8"

services:
  windshift:
    image: ghcr.io/windshiftapp/windshift:v0.5.3
    restart: unless-stopped
    environment:
      - BASE_URL=https://${DOMAIN}
      - PORT=8080
      - USE_PROXY=true
      - SSO_SECRET=${SSO_SECRET}
      - ATTACHMENT_PATH=/data/attachments
      - DB_TYPE=postgres
      - POSTGRES_HOST=db
      - POSTGRES_PORT=5432
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
      - LOG_LEVEL=info
      - LOG_FORMAT=json
    volumes:
      - windshift-data:/data
    depends_on:
      db:
        condition: service_healthy

  db:
    image: postgres:17.4
    restart: unless-stopped
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
    volumes:
      - postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  windshift-data: {}
  postgres-data: {}
