version: '3.8'

services:
  clinical-trial:
    build:
      context: ..
      dockerfile: deliverables/Dockerfile
    container_name: clinical-trial-system
    ports:
      - "8000:8000"
    environment:
      - DATABASE_URL=${DATABASE_URL}
      - HIPAA_COMPLIANCE=true
      - AUDIT_LOG_ENABLED=true
    volumes:
      - trial-data:/app/data
      - audit-logs:/app/logs
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "python3", "-c", "print('healthy')"]
      interval: 30s
      timeout: 10s
      retries: 3

  postgres:
    image: postgres:16-alpine
    container_name: clinical-trial-db
    environment:
      - POSTGRES_DB=clinical_trials
      - POSTGRES_USER=trial_user
      - POSTGRES_PASSWORD=${DB_PASSWORD}
    volumes:
      - postgres-data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    restart: unless-stopped

volumes:
  trial-data:
  audit-logs:
  postgres-data:
