version: '3.8'

services:
  license-server:
    build: .
    container_name: license-server
    restart: unless-stopped
    ports:
      - "8443:8443"
    environment:
      - DATABASE_URL=postgresql://license_user:license_password@db:5432/license_db
      - REDIS_URL=redis://redis:6379
    depends_on:
      - db
      - redis
    networks:
      - license-network

  db:
    image: postgres:15-alpine
    container_name: license-db
    restart: unless-stopped
    environment:
      POSTGRES_USER: license_user
      POSTGRES_PASSWORD: license_password
      POSTGRES_DB: license_db
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - license-network

  redis:
    image: redis:7-alpine
    container_name: license-redis
    restart: unless-stopped
    command: redis-server --appendonly yes
    volumes:
      - redis_data:/data
    networks:
      - license-network

volumes:
  postgres_data:
  redis_data:

networks:
  license-network:
    driver: bridge