You are a Python backend developer. Build a RESTful API using FastAPI to manage a book library. The API should: 1) Support CRUD operations for books (title, author, ISBN, published year), 2) Use MongoDB or PostgreSQL, 3) Implement search by title/author, 4) Include pagination, 5) Add validation for ISBN format, 6) Use dependency injection for database session, 7) Write tests with pytest, 8) Generate OpenAPI documentation. Provide a Dockerfile.