# Use the official NVIDIA CUDA image with cuDNN support on Ubuntu 24.04 as the base image
FROM nvidia/cuda:12.9.0-cudnn-runtime-ubuntu24.04

# Install only runtime dependencies
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        build-essential \
        python3-dev \
        python3-pip \
        python3-venv \
        python3-setuptools \
        python3-wheel \
        casacore-dev \
        libboost-python-dev \
        libcfitsio-dev \
        wcslib-dev \
        git && \
    rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

# Install Python packages
RUN pip3 install --no-cache-dir --break-system-packages -U setuptools setuptools-scm cupy-cuda12x

# Clean up Python cache and other unnecessary files
RUN find /usr/local/lib/python3.*/ -name '*.pyc' -delete && \
    rm -rf /root/.cache /root/.local

# Print a message to verify the image build
RUN echo "Hello from pyralysis base image with cuPy"

# Add Open Container Initiative (OCI) labels for source, description, and license
LABEL org.opencontainers.image.source="https://gitlab.com/clirai/pyralysis"
LABEL org.opencontainers.image.description="Base container image for pyralysis"
LABEL org.opencontainers.image.licenses=GPL3
