This guide will help you set up and run the PDF Q&A system using Docker.
- Docker Desktop installed on your system
- Windows: Download Docker Desktop
- macOS: Download Docker Desktop
- Linux: Install Docker Engine
# Run the setup script
setup-docker.bat# Make the script executable
chmod +x setup-docker.sh
# Run the setup script
./setup-docker.sh-
Create environment file
cp .env.example .env # Edit .env with your API keys -
Build and run with Docker Compose
docker-compose up --build -d
# OpenRouter API Configuration
OPENROUTER_API_KEY=your_openrouter_api_key_here
# Flask Configuration
SECRET_KEY=your-secret-key-here
FLASK_ENV=production
# Application Settings
MAX_FILE_SIZE=16777216# Start the application
docker-compose up -d
# Stop the application
docker-compose down
# View logs
docker-compose logs -f
# Restart services
docker-compose restart# Rebuild and start
docker-compose up --build -d
# Run in development mode (with logs)
docker-compose up --build
# Access container shell
docker-compose exec pdf-qa-app bash# View container status
docker-compose ps
# Check resource usage
docker stats
# Clean up unused images
docker system prune -f- Main Application: http://localhost:5000
- Health Check: http://localhost:5000/status
BJ/
├── Dockerfile # Docker image configuration
├── docker-compose.yml # Multi-container setup
├── .dockerignore # Files to exclude from Docker build
├── requirements.txt # Python dependencies
├── setup-docker.sh # Linux/macOS setup script
├── setup-docker.bat # Windows setup script
├── .env # Environment variables (create from template)
├── web_app.py # Main Flask application
├── app.py # Core PDF processing logic
└── uploads/ # PDF upload directory
-
Port already in use
# Check what's using port 5000 netstat -tulpn | grep 5000 # Kill the process or change port in docker-compose.yml
-
API Key not working
- Verify your OpenRouter API key in
.env - Check API key permissions and credits
- Verify your OpenRouter API key in
-
Memory issues
# Increase Docker memory limit in Docker Desktop settings # Recommended: 4GB+ for AI models
-
Build failures
# Clean build cache docker-compose build --no-cache # Remove old images docker image prune -f
# View application logs
docker-compose logs pdf-qa-app
# Follow logs in real-time
docker-compose logs -f pdf-qa-app
# Check container health
docker-compose ps- Minimum: 2GB RAM, 2 CPU cores
- Recommended: 4GB RAM, 4 CPU cores
- Storage: 2GB+ free space for models and uploads
# Use production environment
FLASK_ENV=production docker-compose up -d
# Enable health checks
# (Already configured in docker-compose.yml)- Change default
SECRET_KEYin production - Use environment variables for sensitive data
- Restrict file upload sizes (configured as 16MB)
- Run containers as non-root user in production
If you encounter issues:
- Check the logs:
docker-compose logs -f - Verify environment variables in
.env - Ensure Docker has sufficient resources
- Check network connectivity for API calls