|
| 1 | +# default base image: ghcr.io/actions/actions-runner:latest |
| 2 | +# base image: Ubuntu 22.04 jammy |
| 3 | +# Prune CUDA to only keep gencode >= A100 |
| 4 | +ARG BASE_IMAGE=ghcr.io/actions/actions-runner:latest |
| 5 | +FROM ${BASE_IMAGE} |
| 6 | + |
| 7 | +ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 |
| 8 | +ARG OVERRIDE_GENCODE="-gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90a,code=sm_90a" |
| 9 | +ARG OVERRIDE_GENCODE_CUDNN="-gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90a,code=sm_90a" |
| 10 | + |
| 11 | +RUN sudo apt-get -y update && sudo apt -y update |
| 12 | +# fontconfig: required by model doctr_det_predictor |
| 13 | +# libjpeg and libpng: optionally required by torchvision (vision#8342) |
| 14 | +RUN sudo apt-get install -y git jq gcc g++ \ |
| 15 | + vim wget curl ninja-build cmake \ |
| 16 | + libgl1-mesa-glx libsndfile1-dev kmod libxml2-dev libxslt1-dev \ |
| 17 | + fontconfig libfontconfig1-dev \ |
| 18 | + libpango-1.0-0 libpangoft2-1.0-0 \ |
| 19 | + libsdl2-dev libsdl2-2.0-0 \ |
| 20 | + libjpeg-dev libpng-dev zlib1g-dev |
| 21 | + |
| 22 | +# get switch-cuda utility |
| 23 | +RUN sudo wget -q https://raw.githubusercontent.com/phohenecker/switch-cuda/master/switch-cuda.sh -O /usr/bin/switch-cuda.sh |
| 24 | +RUN sudo chmod +x /usr/bin/switch-cuda.sh |
| 25 | + |
| 26 | +RUN sudo mkdir -p /workspace; sudo chown runner:runner /workspace |
| 27 | + |
| 28 | +# GKE version: 1.28.5-gke.1217000 |
| 29 | +# NVIDIA driver version: 535.104.05 |
| 30 | +# NVIDIA drivers list available at gs://ubuntu_nvidia_packages/ |
| 31 | +# We assume that the host NVIDIA driver binaries and libraries are mapped to the docker filesystem |
| 32 | + |
| 33 | +# Install CUDA 12.8 build toolchains |
| 34 | +RUN cd /workspace; mkdir -p pytorch-ci; cd pytorch-ci; wget https://raw.githubusercontent.com/pytorch/pytorch/main/.ci/docker/common/install_cuda.sh |
| 35 | +RUN cd /workspace/pytorch-ci; wget https://raw.githubusercontent.com/pytorch/pytorch/main/.ci/docker/common/install_cudnn.sh && \ |
| 36 | + wget https://raw.githubusercontent.com/pytorch/pytorch/main/.ci/docker/common/install_nccl.sh && \ |
| 37 | + wget https://raw.githubusercontent.com/pytorch/pytorch/main/.ci/docker/common/install_cusparselt.sh && \ |
| 38 | + mkdir ci_commit_pins && cd ci_commit_pins && \ |
| 39 | + wget https://raw.githubusercontent.com/pytorch/pytorch/main/.ci/docker/ci_commit_pins/nccl-cu12.txt |
| 40 | +RUN sudo bash -c "set -x;export OVERRIDE_GENCODE=\"${OVERRIDE_GENCODE}\" OVERRIDE_GENCODE_CUDNN=\"${OVERRIDE_GENCODE_CUDNN}\"; cd /workspace/pytorch-ci; bash install_cuda.sh 12.8" |
| 41 | + |
| 42 | +# Install miniconda |
| 43 | +RUN wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /workspace/Miniconda3-latest-Linux-x86_64.sh |
| 44 | +RUN cd /workspace && \ |
| 45 | + chmod +x Miniconda3-latest-Linux-x86_64.sh && \ |
| 46 | + bash ./Miniconda3-latest-Linux-x86_64.sh -b -u -p /workspace/miniconda3 |
| 47 | + |
| 48 | +# Test activate miniconda |
| 49 | +RUN . /workspace/miniconda3/etc/profile.d/conda.sh && \ |
| 50 | + conda activate base && \ |
| 51 | + conda init |
| 52 | + |
| 53 | +RUN echo "\ |
| 54 | +. /workspace/miniconda3/etc/profile.d/conda.sh\n\ |
| 55 | +conda activate base\n\ |
| 56 | +export CONDA_HOME=/workspace/miniconda3\n\ |
| 57 | +export CUDA_HOME=/usr/local/cuda\n\ |
| 58 | +export PATH=/home/runner/bin\${PATH:+:\${PATH}}\n\ |
| 59 | +export LD_LIBRARY_PATH=\${CUDA_HOME}/lib64\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}\n\ |
| 60 | +export LIBRARY_PATH=\${CUDA_HOME}/lib64\${LIBRARY_PATHPATH:+:\${LIBRARY_PATHPATH}}\n" >> /workspace/setup_instance.sh |
| 61 | + |
| 62 | +RUN echo ". /workspace/setup_instance.sh\n" >> ${HOME}/.bashrc |
0 commit comments