services:
  postgres:
    image: postgres:16-alpine
    container_name: xtablo-go-backend-postgres
    restart: unless-stopped
    environment:
      POSTGRES_DB: xtablo
      POSTGRES_USER: xtablo
      POSTGRES_PASSWORD: xtablo
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./internal/db/schema.sql:/docker-entrypoint-initdb.d/001-auth-schema.sql:ro
      - ./internal/db/seed.sql:/docker-entrypoint-initdb.d/002-seed.sql:ro
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U xtablo -d xtablo"]
      interval: 5s
      timeout: 5s
      retries: 10

volumes:
  postgres_data:
