tig-monorepopool/Dockerfile.runtime.cuda
2025-11-01 18:55:43 +01:00

69 lines
2.2 KiB
Docker

ARG BASE_IMAGE=ubuntu:24.04
ARG CHALLENGE
FROM ghcr.io/tig-pool-nk/tig-monorepo/${CHALLENGE}/dev AS dev
FROM ${BASE_IMAGE}
ARG CHALLENGE
ENV CHALLENGE=${CHALLENGE}
RUN if [ -z "$CHALLENGE" ]; then echo "Error: '--build-arg CHALLENGE' must be set." && exit 1; fi
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y python3 python3-pip wget gnupg ca-certificates
# Install CUDA runtime libraries (not the full toolkit)
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \
CUDA_ARCH="sbsa"; \
else \
CUDA_ARCH="x86_64"; \
fi && \
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/${CUDA_ARCH}/cuda-keyring_1.1-1_all.deb && \
dpkg -i cuda-keyring_1.1-1_all.deb && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
cuda-cudart-12-6 \
cuda-nvrtc-12-6 \
libcublas-12-6 \
libcudnn9-cuda-12 && \
rm cuda-keyring_1.1-1_all.deb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set CUDA environment variables
ENV CUDA_HOME=/usr/local/cuda-12.6
ENV CUDA_PATH=/usr/local/cuda-12.6
ENV PATH=${CUDA_HOME}/bin:${PATH}
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}
# Create symlink for CUDA
RUN ln -sf /usr/local/cuda-12.6 /usr/local/cuda && \
ldconfig
RUN pip3 install requests --break-system-packages
COPY scripts/ /usr/local/bin/tig-scripts/
RUN chmod +x /usr/local/bin/tig-scripts/*
ENV PATH="/usr/local/bin/tig-scripts:${PATH}"
COPY --from=dev /usr/local/bin/tig-runtime /usr/local/bin/tig-runtime
COPY --from=dev /usr/local/bin/tig-verifier /usr/local/bin/tig-verifier
COPY --from=dev /usr/local/lib/rust /usr/local/lib/rust
RUN chmod +x /usr/local/bin/tig-runtime && \
chmod +x /usr/local/bin/tig-verifier
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib/rust"
# Create symlinks for cudnn if needed
RUN if ls /usr/lib/*-linux-gnu/libcudnn*.so.[0-9] 1>/dev/null 2>&1; then \
for f in /usr/lib/*-linux-gnu/libcudnn*.so.[0-9]; do \
ln -sf "$(basename "$f")" "${f%.*.*}.so"; \
done; \
fi
# Run ldconfig to update library cache
RUN ldconfig
WORKDIR /app