FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    libgl1-mesa-glx libglib2.0-0 libpq-dev gcc \
    && rm -rf /var/lib/apt/lists/*

# Install shared package
COPY packages/shared /app/packages/shared
RUN pip install --no-cache-dir -e /app/packages/shared

# Install training package
COPY packages/training /app/packages/training
RUN pip install --no-cache-dir -e /app/packages/training

WORKDIR /app/packages/training

CMD ["python", "run_training.py", "--task-id", "${TASK_ID}"]
