| # Dockerfile for Agent Worker / Learning Worker (adjust base image for GPU if needed) | |
| # Use a base image with Python and potentially CUDA for GPU support (for learning worker) | |
| # FROM python:3.10-slim | |
| FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04 # Example GPU base image | |
| WORKDIR /app | |
| # Install system dependencies (e.g., for psycopg2, git) | |
| # RUN apt-get update && apt-get install -y --no-install-recommends gcc libpq-dev git && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| # Install Python dependencies (consider using a virtual environment) | |
| # Ensure torch is installed correctly for CPU/GPU | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # OR specific torch version: | |
| # RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 | |
| # RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| # Set environment variables (can also be done via docker-compose.yml) | |
| ENV OPENAI_API_KEY=your_openai_key | |
| ENV POSTGRES_DSN=postgresql://user:password@postgres:5432/agentdb # Use service name 'postgres' | |
| ENV REDIS_URL=redis://redis:6379/0 # Use service name 'redis' | |
| ENV BASE_MODEL_NAME=gpt-4o-mini | |
| # Add other ENV vars as needed (NUM_WORKERS, etc.) | |
| # Command to run the worker (or learning script) | |
| # CMD ["python", "your_main_script.py"] | |
| # Use different CMD for agent worker vs learning worker containers if separated |